thanks Mr.Stephen your solution solved my problem. But now I want to use COALASCE function in a function which uses 'plpgsql' language.(function needs to perform same functionality as it was in SQL language)
Select cast(MyView."Document_ID" as
Text)||','||cast(MyView."First_Name" as
Text)||','||cast(MyView."Last_Name" as
Text)||','||Coalesce(cast(MyView."Sent_Date" as Text),'NONE') From "MyView"
Where "Document_ID"=$1;
Language 'plpgsql';
But it gives error "Bad date external representation 'NONE' "....
is it some syntax mistake or what ?
Stephan Szabo <sszabo@megazone23.bigpanda.com> wrote:
On Thu, 30 May 2002, Tahira Aslam wrote:
> Select Coalesce(cast(MyView."Document_ID" as
> Text)||','||cast(MyView."First_Name" as
> Text)||','||cast(MyView."Last_Name" as
> Text)||','||cast(MyView."Sent_Date" as Text),'NONE') From "MyView"
> Where "Document_ID"=$1;
If you want a part of the string to become NONE if null, you need
to coalesce each part (I'm dropping the casts for now):
select coalesce(MyView."Document_ID", 'None') || ',' ||
coalesce(MyView."First_Name", 'None') || ...
Do You Yahoo!?Yahoo! - Official partner of 2002 FIFA World Cup