Re: postgresql function not accepting null values inselect statement

From: johnf <jfabiani(at)yolo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: postgresql function not accepting null values inselect statement
Date: 2008-02-22 16:30:56
Message-ID: 200802220830.56917.jfabiani@yolo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message felix 2008-02-22 18:00:21 Delete with foreign keys
Previous Message Bart Degryse 2008-02-22 09:35:47 Re: postgresql function not accepting null values inselect statement