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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C variable substitution

Re: Pro*C variable substitution

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: Wed, 29 Sep 1999 07:54:06 -0400
Message-ID: <37F1FDDE.E78B7530@Unforgettable.com>


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

Original text of this message

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