Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pro c database link problem
A copy of this was sent to kshave_at_health.gov.mb.ca
(if that email address didn't require changing)
On Fri, 12 Mar 1999 14:15:22 GMT, you wrote:
>I have the following Pro C code ...
>
>strcpy(link_name, "DEVL");
>
>exec sql
> select prod_e
> into :DIN_prod_e
> from dinmst_at_link_name
> where din = :DIN_din;
>
>The database link DEVL exists in the database.
>Link_name is a variable holding DEVL is not being properly translated. When
>executing, dinmst_at_link_name is used instead of the contents of link_name which
>would provide dinstmst_at_DEVL.
>
you will have to use dynamic sql. anytime you want to alter an IDENTIFIER you will be using dynamic sql.
could look like this:
{
VARCHAR uname[35]; VARCHAR query[255];
EXEC SQL WHENEVER SQLERROR DO sqlerror_hard();
sprintf( query.arr, "select user from dual@%s", "oeprd.world" ); query.len = strlen(query.arr);
EXEC SQL PREPARE S FROM :query;
EXEC SQL DECLARE C CURSOR FOR S;
EXEC SQL OPEN C;
EXEC SQL FETCH C INTO :uname;
EXEC SQL CLOSE C;
printf( "%.*s\n", uname.len, uname.arr );
}
>Is there another way to accomplish this?
>
>-Keith
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |