I have this function:
CREATE OR REPLACE FUNCTION findMyList( p_user_id bigint)
....
DECLARE
myVar_id bigint;
...
IF myVar_id = select p_user_id from myFunction(p_user_id ) THEN
NULL;
ELSE
myVar_id := NULL;
END IF;
however there appears to be a syntax issue that I can’t work out why it does not allow this as it doesnt seem unreasonable:
ERROR: syntax error at or near "select" LINE 78: IF myVar_id = select p_user_id from myFunction...
why does it not let me define the variable as such?
Advertisement
Answer
Try :
myVar_id := (SELECT p_user_id from myFunction(p_user_id))