OTL Translation (9)--Constant SQL statement

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.