davidzxc574
davidzxc574

Reputation: 481

Oracle sqlplus executes sql file in windows batch

I have Sqlplus installed and ran a batch file below in cmd.

"D:\setups\instantclient_11_2\sqlplus.exe" username/password@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=111.111.111.11) (PORT=1521)))(CONNECT_DATA=(SID=orcl)))"  @"E:\sql scripts\procedure.sql"

This is what I got. And my procedure means to insert records into a table but that table is still empty.

E:\p01-material big data projects\batch>sql.bat

SQL*Plus: Release 11.2.0.4.0 Production on 星期四 1月 25 11:22:29 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
  6

It stays here forever. And the 6 is here probably because my sql file procedure.sql has 6 lines of statement. How can I make this work?

Thanks

Upvotes: 1

Views: 290

Answers (1)

Littlefoot
Littlefoot

Reputation: 142713

The last line in your PROCEDURE.SQL should be a forward slash, /. It shows SQL*Plus that you've terminated the procedure and will run it.

Or, when you see that "6" (it is the line number; SQL*Plus waits you to enter something), enter / and press "Enter" key on the keyboard.

Upvotes: 1

Related Questions