| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> EXEC SQL <action> and EXEC SQL EXECUTE IMMEDIATE :<host of action>
Hi,
I have got the different results of the running when using
and
2. EXEC SQL BEGIN DECLARE SECTION;
const char *host_action_line = "<action>"
EXEC SQL END DECLARE SECTION;
EXEC SQL EXECUTE IMMEDIATE :host_action_line;
Is anything wrong?
Do both EXEC SQL <action> EXEC SQL and EXECUTE IMMEDIATE
:host_action_line
have to produce the same result?
Thanks,
Alex
//#########################################################
//------------------- Pro*C++ code : BEGIN ----------------
//==========================
//==========================
//=========================================void sql_error_action ()
assert (0);
}
//=========================================void test1()
cout << endl << "Test#1" << endl;
EXEC SQL WHENEVER NOT FOUND GOTO case_error;
EXEC SQL SELECT TABLE_NAME FROM USER_TABLES WHERE
TABLE_NAME='KKK123';
cout << "OK : sqlca.sqlcode == " << sqlca.sqlcode << endl;
return;
case_error :
cout << "FAULT : sqlca.sqlcode == " << sqlca.sqlcode <<
endl;
return;
} // void test1()
//=========================================void test2()
cout << endl << "Test#2" << endl;
EXEC SQL BEGIN DECLARE SECTION;
const char *host_action_line = "SELECT TABLE_NAME FROM USER_TABLES
WHERE TABLE_NAME='KKK123'";
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER NOT FOUND GOTO case_error;
EXEC SQL EXECUTE IMMEDIATE :host_action_line;
cout << "OK : sqlca.sqlcode == " << sqlca.sqlcode << endl;
return;
case_error :
cout << "FAULT : sqlca.sqlcode == " << sqlca.sqlcode <<
endl;
return;
} // void test2()
//===============================
char *username = "aaa"; char *password = "bbb";
//===========================
EXEC SQL WHENEVER SQLERROR DO sql_error_action ();
EXEC SQL CONNECT :username IDENTIFIED BY :password;
//===========================
test1 ();
test2 ();
return 0;
//------------------- Pro*C++ code : END ------------------ //#########################################################//-------------- Results of the Running : BEGIN -----------
Test#1
FAULT : sqlca.sqlcode == 1403
Test#2
OK : sqlca.sqlcode == 0
//-------------- Results of the Running : END -------------
//######################################################### //------------------- Environment ------------------------- === Oracle 8.0.5 === Pro*C/C++ : Release 8.0.5.0.0
//--------------------------------------------------------- //#########################################################
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Oct 24 1999 - 05:32:21 CDT
![]() |
![]() |