Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[GENERAL] Excluding null return values from functions

0 views
Skip to first unread message

Jason Armstrong

unread,
Nov 25, 2009, 6:59:19 AM11/25/09
to
How do I give a condition on the return value of a function (for
example plperl)?

I have a perl search function that returns either a bigint, or undef
if nothing is found. I want to exclude the undef/null return values
from my select statement, something like:

sql> select search(data, 'field', 'value') as result from mydata where
result is not null;

--
Jason Armstrong

--
Sent via pgsql-general mailing list (pgsql-...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Pavel Stehule

unread,
Nov 25, 2009, 7:03:56 AM11/25/09
to
2009/11/25 Jason Armstrong <j...@riverdrums.com>:

> How do I give a condition on the return value of a function (for
> example plperl)?
>
> I have a perl search function that returns either a bigint, or undef
> if nothing is found. I want to exclude the undef/null return values
> from my select statement, something like:
>
> sql> select search(data, 'field', 'value') as result from mydata where
> result is not null;

select result from (select search(data, 'field','value') as result
from mydata) x where result is not null;

regards
Pavel Stehule

0 new messages