I've got a problem with a function: It receives two parameters, the
first, the table name, and the second, a where condition. The function
looks like this:
DECLARE cod bigint; query TEXT;
BEGIN query = 'SELECT codigo FROM ' || $1 || ' WHERE ' || $2;
EXECUTE query INTO cod; · · · END;
I've alwais get the same error, in the EXECUTE sentence: it says:
Error at or near NULL at character X
I've also tried declaring cod as row, but the error is the same.
Anybody can help me?
Thank you very much