Dear Friends,
I am using postgres 7.3.4 running on RH Linux 7.2. While writing dynamic SQL stmts, i have the following problem. Using cursor works fine.
OPEN ref FOR
EXECUTE
\'SELECT comma(full_name) FROM (SELECT usr.full_name
FROM project_members,users usr
WHERE project_members.project_role_id IN\'||\'(\'|| p_res_ids||\')
AND usr.usr_id = project_members.usr_id
ORDER BY usr.full_name)foo\';
RETURN ref;
While I try to assign the value into a local variable v_names , it is not working
EXECUTE
\'SELECT comma(full_name) INTO '||v_names||' FROM (SELECT usr.full_name
FROM project_members,users usr
WHERE project_members.project_role_id IN\'||\'(\'|| p_res_ids||\')
AND usr.usr_id = project_members.usr_id
ORDER BY usr.full_name)foo\';
RETURN v_names;
Why is it so. Cant I use 'INTO [variable_name]' inside a dynamic query. Please shed some light.
Regards
Kumar