Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Pro*C variable substitution
Hi,
I have several sql quereies in my pro*c program such as following:
EXEC SQL select column1 into :temp from table;
I would like to prefix the table name with a user_name. The user name
need not be dynamic but rather static because I would like every one
running this program use a common table rather than their individual
table. I would like to use the user name as a variable (some thing like
#define) rather than hard coded values so that I can change the value
when testing.
Accoring to pro*c manual you cannot use host variables to supply sql
keywords or the names of database objects. So the only solution I can
think of, to circumvent this bottle neck is to write the query to a
string (sprintf(sql_query, "select ...")) and then EXEC SQL PREPARE Q
from :sql_query;
Is there an alternative/efficient way to acheive the same results? Thanks for any help.
-Deepa Received on Tue Sep 28 1999 - 16:58:37 CDT
![]() |
![]() |