Problem with dynamic query - Mailing list pgsql-sql

From Kumar
Subject Problem with dynamic query
Date
Msg-id 01c301c3bb2d$76596b80$7502a8c0@hdsc.com
Whole thread Raw
Responses Re: Problem with dynamic query
List pgsql-sql
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

pgsql-sql by date:

Previous
From: Jamie Lawrence
Date:
Subject: Re: relationship/table design question
Next
From: Tomasz Myrta
Date:
Subject: Re: Problem with dynamic query