A constant SQL statement an SQL statement that has no bound variables, a SQL statement block, or a stored procedure is called a constant SQL statement. OTL executes such SQL statements through a static function. For example://static otl_cursor::d irect_exec ()otl_cursor::d irect_exec (DB,//Connect Object "CREATE TABLE Test_tab (f1 int, f2 varchar ())" ); //CREATE TABLEotl_cursor::d irect_exec (DB,//Connect Object "drop table Test_tab",//statement or PL/SQL blockOtl_exception::d isabled//Disable OTL exceptions,//in other words, ignore any//Database Error);//drop table//or Otl_connect::d irect_exec ()db.direct_exec//Connect Object("CREATE TABLE Test_tab (f1 int, f2 varchar ())" ); //CREATE TABLEdb.direct_exec//Connect Object("drop table Test_tab",//statement or PL/SQL blockOtl_exception::d isabled//Disable OTL exceptions,//in other words, ignore any//Database Error);//drop table//or otl_connect::operator<< (const char*)DB<<"CREATE TABLE Test_tab (F1 number, F2 varchar2 ())"; Try{db<<"drop table Test_tab"";//statement or PL/SQL block}Catch(otl_exception&){ //Ignore a database error}otl_cursor is an inner class of OTL. It is an underlying class for the direct_exec () function. Because later versions of this class may no longer be available externally, it is not recommended. The following example returns the result value for Direct_exe ()://static otl_cursor::d irect_exec LongRpc=otl_cursor::d irect_exec (DB,//Connect Object "Delete from Test_tab where f1>=95" ); cout<<"Rows deleted:"<<rpc<<Endl;//or Otl_connect:direct_exec LongRpc=db.direct_exec//Connect Object("Delete from Test_tab where f1>=95" ); cout<<"Rows deleted:"<<rpc<<endl;
OTL Translation (9)--Constant SQL statement