Re: Quoting for a Select Into - Please Help

From: "ezra epstein" <ee_newsgroup_post(at)prajnait(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Quoting for a Select Into - Please Help
Date: 2004-01-14 18:57:27
Message-ID: x6icnRfEp6N8DZjdXTWc-w@speakeasy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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" <cooljoint(at)yahoo(dot)com> wrote in message news:20040114170919(dot)34287(dot)qmail(at)web12102(dot)mail(dot)yahoo(dot)com(dot)(dot)(dot)
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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben 2004-01-14 19:02:51 Re: Postgress and MYSQL
Previous Message Joshua D. Drake 2004-01-14 18:45:07 Re: Postgress and MYSQL