Hi,
Is it possible to pass a null value into a PL/pgSQL function. For example
CREATE TABLE mytable(id int, name text);
CREATE OR REPLACE FUNCTION myfunc(int, text) returns int AS '
DECLARE
_id ALIAS FOR $1;
_name ALIAS FOR $2;
BEGIN
EXECUTE ''INSERT INTO mytable (id, name) VALUES(''||_id||'',
''''''||_name||'''''')'';
RETURN _id;
END
' LANGUAGE 'plpgsql';
Now, this works ok
select myfunc(1, 'foo');
However, this fails
select myfunc(1, null);
Is there a way of doing it such that I can pass a null sometimes?
Thanks for any help
Adam
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.