Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Variables in select statement?

Re: Variables in select statement?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 01 Sep 1999 15:27:21 GMT
Message-ID: <37d145a3.103942241@newshost.us.oracle.com>


A copy of this was sent to "Nicky" <nickyterwel_at_hotmail.com> (if that email address didn't require changing) On Wed, 1 Sep 1999 17:06:28 +0200, you wrote:

>This is what we are trying to do, but it doesn't work.
>
>select strColumnName1 from strTableName where strColumnName2 = strValue;
>
>When we don't use the variables but the real values instead it works just
>fine.
>What am I doing wrong?
>
>Nicky Terwel
>
>

You need to use dynamic sql to do that (replace column and tablenames) in a query. The query needs to be parsed before each and every execution.

what language are you using?
what environment are you in?

then, we might be able to help you out.

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Sep 01 1999 - 10:27:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US