From: | "David Gagnon" <dgagnon(at)accovia(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | quote_literal Simple question |
Date: | 2005-02-18 14:07:12 |
Message-ID: | 005201c515c3$24bc66a0$900210ac@ddell074 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
I did a stored procedure and ran into this small problem.
Here itemIdValue may be null and I would have expected quote_literal to
returns null as a string or the value quoted. For now I think it returns a
real null. This causes my function to crash.
insertStatement:= ''INSERT INTO IL ( ILNUM, ILTYPE, ILICNUM, ILRRNUM, ILQTE,
ILPRIX, ts ) VALUES ( '' || idValue ||'', ''|| typeValue ||'','';
insertStatement:= insertStatement ||
quote_literal(itemIdValue) || '','';
insertStatement:= insertStatement ||
I haven't found an existing function to handle this case and I hate
reinventing the Wheel... Is there a function that already handles that?
For now I worked around this by using the COALESCE function.
COALESCE(quote_literal(itemIdValue),'' null'') || '','';
insertStatement:= insertStatement ||
Thanks for your help
/David
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
From | Date | Subject | |
---|---|---|---|
Next Message | Terry Lee Tucker | 2005-02-18 14:26:18 | Re: quote_literal Simple question |
Previous Message | Richard Huxton | 2005-02-18 13:01:28 | Re: db replication and errors |