2.11. Batch Command Files

The previous section illustrates SQL*Plus scripts totally embedded within another scripting language, in this case Korn Shell. You can alternatively invoke SQL*Plus as an executable program passing as arguments: the username, password, and connect string.

The following is a host script file that will invoke SQL*Plus. Section 2.9, “Command Line Arguments,” contains a SQL script, QUERY_V1.SQL, that accepts a single command line parameter. This same script can be invoked in a batch script, shown next.

echo "host scripting language"
sqlplus scott/tiger@ora10 @c:\my_sqlplus\query_v1.sql
status
exit
echo "host scripting language"

If you do not have an EXIT within the SQL*Plus script, and that certainly is one option, then ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.