Excecute sql scripts with SqlPlus in shell script

I want to execute a sql script with SqlPlus in a shell script.  Something like this:

sqlplus usr/pwd@SID @../../procedures/insert_test.sql

This works and creates the procedure but ends with sqlplus still running:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning option
Procedure created.

SQL>

How should this be done so that sqlplus closes after the procedure is created?
jkavxAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
The other (non-traditional, more restricted) way is to just pipe the script in:
  sqlplus usr/pwd@SID < ../../procedures/insert_test.sql
0
 
HainKurtSr. System AnalystCommented:
add

/

or add

exit;
/
0
 
jkavxAuthor Commented:
Thx.  I'm finding that piping the script in works.

 But I tried both / and exit; / and neither makes a difference.  The insert_test.sql itself ends with /.  I dont' know if that's a factor.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.