Re: postgresql function not accepting null values inselect statement - Mailing list pgsql-sql

From johnf
Subject Re: postgresql function not accepting null values inselect statement
Date
Msg-id 200802220830.56917.jfabiani@yolo.com
Whole thread Raw
In response to Re: postgresql function not accepting null values inselect statement  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Responses Re: postgresql function not accepting null values inselect statement
Re: postgresql function not accepting null values inselect statement
List pgsql-sql
On Friday 22 February 2008 01:35:47 am Bart Degryse wrote:
> Can you try this...
>
> CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer)
>   RETURNS SETOF t_functionaries AS
> $BODY$
> DECLARE
>   rec t_functionaries%ROWTYPE;
> BEGIN
>   FOR rec IN (
>     SELECT f.functionaryid, f.category, f.description
>     FROM functionaries f
>     WHERE f.statecd IS NOT DISTINCT FROM p_statecd)
>   LOOP
>     return next rec;
>   END LOOP;
>   return;
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
>
a newbie question.  Could you explain why yours works?  I don't understand how 
it works if p_statecd = NULL


-- 
John Fabiani


pgsql-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: SQL standards in Mysql
Next
From: "Scott Marlowe"
Date:
Subject: Re: SQL standards in Mysql