Saturday, October 31, 2009

2.11 Batch Command Files



[ Team LiB ]





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 you will need an EXIT following the invocation of SQL*Plus. The EXIT is needed to take you out of SQL*Plus and back into the original shell.





    [ Team LiB ]



    No comments: