Home » RDBMS Server » Server Utilities » urgent::dynamic sql in pro*C
urgent::dynamic sql in pro*C [message #71667] Fri, 13 December 2002 03:18 Go to next message
srivani
Messages: 3
Registered: December 2002
Junior Member
can i give a name of the table as a variable in dynamic statement in a proc program;

like select * from :tname;
please tell me the answer ASAP
it will be really helpful to me
thanks and regards
vani
Re: urgent::dynamic sql in pro*C [message #71996 is a reply to message #71667] Mon, 17 February 2003 18:43 Go to previous message
locs
Messages: 1
Registered: February 2003
Junior Member
you may try the following sample codes:

char *tablename = "sample";
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR sqlstatement [[30]];
EXEC SQL END DECLARE SECTION;

sqlstatement.len = sprintf ((char *) sqlstatement.arr, "select * from %s", tablename);

EXEC SQL EXECUTE IMMEDIATE :sqlstatement;
Previous Topic: sqlldr and default values - Can this be done???
Next Topic: Loading data in more than one table using SQL Loader
Goto Forum:
  


Current Time: Tue Dec 24 06:28:58 CST 2024