By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Quoting for a Select Into - Please Help

P: n/a
A E
Hi,

Could someone help me with quoting this right?

select into aliasvalue ''|| trim(arrayval[i]) ||'' from ''|| trim(realname) ||'' where ''|| trim(searchfield) ||'' like ''''%''|| trim(searchvalue) ||''%'''';

The parser does not seem to want to put the value of the variables into the statement.

Alex

Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Maybe if you could show what the final SELECT statement should look like -- after variable substitution -- that would give a sense of how to quote things.

NOTE 1. Regardless, this, of course, needs to be done inside of an EXECUTE statement (assuming pl/pgSQL is the procedure language being used), regular ol' SELECT does not do the dynamic variable substitution this would require.

NOTE 2. Another way (that also avoids use of EXECUTE) is to put the values being stored in "arrayval[]", "realname", etc. into a temporary table and join to this (single-row) temp table in the select.... performance may be an issue, but it would work even outside of pl/pgsql.

== Ezra Epstein
"A E" <co*******@yahoo.com> wrote in message news:20************************@web12102.mail.yaho o.com...
Hi,

Could someone help me with quoting this right?

select into aliasvalue ''|| trim(arrayval[i]) ||'' from ''|| trim(realname) ||'' where ''|| trim(searchfield) ||'' like ''''%''|| trim(searchvalue) ||''%'''';

The parser does not seem to want to put the value of the variables into the statement.

Alex
Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.