On Thu, 30 May 2002, Tahira Aslam wrote:
>
> 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' "....
Well, the above isn't legal plpgsql really (you'd need to be using
two quotes around NONE and there's a missing begin/end, I assume
you're just not showing those).
Hmm, on current sources similar structures with coalesce seem to work as
long as the cast is done.
Can you give enough of the schema to recreate the specifics of your
situation (table structure, view structure and the function).