Oracle batch execution SQL

Source: Internet
Author: User
OracleExecute SQL bat Connection database statement in batches

First, create a text file and write SQL Code
    1. Sqlplus Scott/tiger @ zlkj_kk @ runsql. SQL
 
Sqlplus Scott/tiger @ zlkj_kk @ runsql. SQL

Save the file and change the file extension to. bat.

Then create a text file under the same level directory

Write SQL code in it

  1. -- Change sys and zlkj to the user name and password with sysdba permissions (for example, sys user)
  2. Conn sys/zlkj @ zlkj_kkAsSysdba
  3. -- Write SQL statements
  4. Insert IntoKK. HMDValues('Heisetoufa','Love','Zisetoufa');
  5. -- Submit
  6. Commit;
  7. -- Remove the comment below to stop the DOS Interface
  8. -- Pause press any key to continue ......
  9. -- Exit
  10. Exit
-- Change sys and zlkj to the username and password with sysdba permissions (for example, sys user) Conn sys/zlkj @ zlkj_kk as sysdba -- write SQL statement insert into KK. HMD values ('deleteoufa ', 'love', 'deleteoufa'); -- submit commit; -- remove the comment below to stop the DOS interface. -- press any key to continue ...... -- exit

It is noted clearly that the SQL statement is connected and executed.

Change the file name to the called file name in the batch processing file, which is runsql. SQL.

Save

In this case, a batch is connected and the SQL statement is executed in batches.ProgramCreated.

You only need to double-click the batch file to execute it.

Examples of Multiple SQL statements: sql1.dml
Sql2.dml
Sql3.dml
Sequential execution.
Edit sql1 and add it to the end of the file
If the three files are in the same directory:
@ Sql2.dml
@ Sql3.dml
If not in the same path
@ Absolute path \ sql2.dml
@ Absolute path \ sql3.dml

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.