Precompilers and OCI (MOSC)

MOSC Banner

unable to use dynamic sql and Pro*C

edited Aug 1, 2011 2:22AM in Precompilers and OCI (MOSC) 16 commentsAnswered ✓
I'm trying to write some code using dynamic SQL and Pro*C

I can compile and execute but the results are not what is expected.

void mytest()
 {
  EXEC SQL BEGIN DECLARE SECTION;

  varchar myid[ID_SIZE];
  short myid_x=0;
  long mycount=0L;

 EXEC SQL END DECLARE SECTION;

 // always returns zero
 EXEC SQL PREPARE s FROM "select count(*) into :mycount from tbl1";

 EXEC SQL DECLARE c CURSOR FOR s;

 EXEC SQL OPEN c;

 EXEC SQL FETCH c INTO :mycount;


 // always returns null
 EXEC SQL PREPARE s FROM "select xid into :myid from tb1";

 EXEC SQL DECLARE c CURSOR FOR s;

 EXEC SQL OPEN c;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center