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

Home -> Community -> Usenet -> comp.databases.oracle -> Variable inside a variable

Variable inside a variable

From: Dean Pearson <dean_at_p-c-s.com.au>
Date: 30 May 2004 00:14:04 -0700
Message-ID: <2836d7d5.0405292314.5d46cbba@posting.google.com>


This is a little hard to explain, but please bear with me ...

I'm writing a package in PL/SQL and in one of my procedures I am retrieving data from a db table. This table has a column which possibly has a variable name in it.

By using a cursor I have a variable holding the value which is another variable name of the. How can i use the variable I have with dsql so that i have a sql statement that gives uses the value of the variable that is named in the initial variable.

eg

v_myVar1 := 'foo';
v_myVar2 := 'v_myVar1';

v_sqlString := 'SELECT '||v_myVar2||' FROM DUAL';

it will give me v_myVar1 when i want the output to be foo!??!

I'm guessing i want some like eval that executes the variable then parses it to the string.

Does anyone have any ideas?

Thanks in advance Received on Sun May 30 2004 - 02:14:04 CDT

Original text of this message

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