OracleExecute SQL bat Connection database statement in batches
First, create a text file and write SQL
Code
- 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
- -- Change sys and zlkj to the user name and password with sysdba permissions (for example, sys user)
- Conn sys/zlkj @ zlkj_kkAsSysdba
- -- Write SQL statements
- Insert IntoKK. HMDValues('Heisetoufa','Love','Zisetoufa');
- -- Submit
- Commit;
- -- Remove the comment below to stop the DOS Interface
- -- Pause press any key to continue ......
- -- Exit
- 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