Hi all,
i could not do variable substitution in plpgsql procedure.
The variable names are taken as it is but not substituted in the SQL query.
what could be the problem ?
code looks like this:
------------------------------------------------------------------
CREATE OR REPLACE FUNCTION test(a text) RETURNS SETOF RECORD AS $$
DECLARE
a text;
b text;
BEGIN
IF a = 'odd' THEN
b := 10;
c := 30;
ELIF a = 'even' THEN
b := 20;
c := 40;
END IF;
FOR result IN "SELECT x,y,z FROM mydata WHERE x = a AND y < b AND z > c" LOOP
RETURN NEXT result;
END LOOP;
END;
$$ language 'pgplsql';
-------------------------------------------------------------
tia
KM