Re: How to pickup null values in SQL Language?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: How to pickup null values in SQL Language?
Дата
Msg-id 20020530222104.A12668@svana.org
обсуждение исходный текст
Ответ на How to pickup null values in SQL Language?  (Tahira Aslam <tahira_aslam@yahoo.com>)
Ответы Re: How to pickup null values in SQL Language?  (Tahira Aslam <tahira_aslam@yahoo.com>)
Список pgsql-general
On Thu, May 30, 2002 at 04:42:14AM -0700, Tahira Aslam wrote:
>
> I have written this function in SQL Language in postgresql 7.2.
>
> CREATE FUNCTION MyFunction() RETURNS SETOF Text AS '
>
> Select MyView."Document_ID"||','||MyView."First_Name"||','||MyView."Last_Name"||','||MyView."Sent_Date" "From MyView"
Where"Document_ID"=$1; 
>
> ' LANGUAGE 'SQL';
>
> It worked fine...returning me multiple records of concatenated
> string,until there came a record where "Sent_Date" field was Null.It
> returned nothing then.

Lookup the coalesce function.

> I want to put a check to set null values equal to zero(namely to set
> "sent_Date"=0 If it is Null) , but looks like SQL does not support "IF
> THEN ELSE".plz let me know how can i put that check in this function.?

Lookup CASE/WHEN/THEN/ELSE/END.

HTH,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America

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

Предыдущее
От: Wei Wang
Дата:
Сообщение: Cannot build JDBC driver in 7.1.3.
Следующее
От: Wei Wang
Дата:
Сообщение: erros when making examples in /src/test/examples