Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C variable substitution
Sounds like a good case for Dynamic Sql Method 2.
Deepa Dinendra wrote:
>
> 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 Wed Sep 29 1999 - 06:54:06 CDT
![]() |
![]() |