Oracle CEO SQL

Source: Internet
Author: User

What should I do if a very long SQL statement cannot be executed? See the following solution:

 /*  ----------------------------------- | The ceo SQL statement, such as the parameter and value is very large ----------------------------------------  */  Create   Or   Replace   Procedure Sp_executelog (ssql In   Varchar2 , Slong In Clob) Is  Begin    Execute Immediate ssql using slong;  Commit  ;  End  Sp_executelog;  --  Usage  Create   Table  Temptable (ID  Number  ,  Str  Clob)  --  ------------ Example 1: normal method ---------------------------- Begin  Sp_executelog (  '  Insert into temptable (ID, STR) values (1,: Str)  ' , To_clob ( '  14  '  ));  End  ;  --  ------------ Example 2, nesting type of quotation marks ----------------------------  Declare  Sqlstr  Varchar2 ( 32767 ): =  '  Update t_table set inetworktype_id = 1, swhererules_cn =  ''''  , Iuserid = 2804, dupdatedate = to_date (  ''  2012-04-19  ''  ,  ''  YYYY-MM-DD  ''  ), Sperftype = ''  Perf_gsmcell  ''  , Ssql =: Str where stemplateid =  ''  37606  '''  ; Val clob:  = To_clob ( '  Select to_char (ddate,  ''''  Yyyy  ''''  ) Y from table where ddate> = (sysdate-interval ''''  1  ''''  Year)  '  );  Begin  Sp_executelog (sqlstr, Val );  End ;

 

Related Article

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.