Oracle transaction processing multiple SQL statements

Source: Internet
Author: User

Problem: execute a piece of code to reverse a string, which is to execute multiple SQL statements. How to make it pass in Oracle. I want to think about dynamic SQL. execute immediate is a syntax for parsing and Executing standard SQL statements. You only need to format the statement to be executed in this string. For example, the strings of Multiple SQL statements to be executed are:

Delete tableA where Aid = 1; update tableB where Bid = 2; insert into tableC values (id, 3,4 );

An SQL statement like this cannot be executed together. It is okay to add some formatting points,

To do this, begin execute immediate 'delete tableA where Aid = 1'; execute immediate 'Update tableB where Bid = 2'; execute immediate 'insert into tableC values (id, 3, 4 )'; END;

Note that you must write the format, such as the semicolon after END. In this way, you can execute this string in ORACLE.

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.