If you want to keep the same functions just do as follows
CREATE OR REPLACE FUNCTION nvl(TEXT,TEXT) RETURNS TEXT AS '
BEGIN
RETURN COALESCE($1,$2);
END;' LANGUAGE 'plpgsql';
You will have to do this for all supported data types unless you want to
put in a third parameter that would be the cast
You don't need to build any function for this, you have them ready:
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-conditional.html#AEN9753
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-conditional.html#AEN9698
Cheers,
Csaba.
On Wed, 2003-08-
Hi,
I'll try to switch from Oracle to postgres for some small applications.
Is it possible to build functions like Oracle's nvl or decode with
pgplsql?
How can I make a function like nvl that works for every datatype?
Best regards,
Christian
Try coalesce. The syntax is the same as nvl.
Jeff
-