Re: postgresql function not accepting null values in select statement

Поиск
Список
Период
Сортировка
От Jyoti Seth
Тема Re: postgresql function not accepting null values in select statement
Дата
Msg-id 001a01c87534$84eea280$8ecbe780$@com
обсуждение исходный текст
Ответ на Re: postgresql function not accepting null values in select statement  (Richard Huxton <dev@archonet.com>)
Ответы Re: postgresql function not accepting null values in select statement  (Richard Huxton <dev@archonet.com>)
Re: postgresql function not accepting null values inselect statement  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Список pgsql-sql
Hi,

I have a the following procedure 

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.descriptionFROM functionaries f    where
f.statecd=p_statecd
LOOP       return next rec;       END LOOP;      return;  end;
$BODY$ LANGUAGE 'plpgsql' VOLATILE;

In the functionaries table statecd is a null field. When I pass some integer
value to the above procedure it works correctly but if I pass null value in
p_statecd it doesn't show anything whereas it has values and if I write the
select statement separately it gives values

Thanks,
Jyoti

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com] 
Sent: Friday, February 22, 2008 2:35 PM
To: Jyoti Seth
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] postgresql function not accepting null values in select
statement

Jyoti Seth wrote:
> 
> If I pass null value as the parameter of postgresql function, which is
used
> in the where clause of select statement is not functioning properly.

Either:

1. You're talking about frooble(), in which case it's supposed to do that.

or

2. You'll need to tell us what function it is, how you're using it and 
what you think should happen.

My guess is that you're getting a null as the result and that's not 
doing what you'd expect in your where clause.


--   Richard Huxton  Archonet Ltd



В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: postgresql function not accepting null values in select statement
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: postgresql function not accepting null values in select statement