From: Kumar <sgnerd@yahoo.com.sg>
To: psql <pgsql-sql@postgresql.org>
Subject: Problem with dynamic query
Date: Fri, 5 Dec 2003 18:13:50 +0530
Message-ID: <01c301c3bb2d$76596b80$7502a8c0@hdsc.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sgnerd@yahoo.com.sg
Subject: Re: Problem with dynamic query
In-Reply-To: <01c301c3bb2d$76596b80$7502a8c0@hdsc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox