oracle - run sql script from shell script -


I have an empty shell script that calls a SQL script The problem is that SQL calls the script, I Username, password, DBN, and after that it creates a table but it does not come out of the SQL prompt.

test.sh

  #! / Usr / bin / ksh sql_test = test.sql $ ORACLE_HOME / bin / sqlplus / nolog @ $ {sql_test} exit  

test.sql

  Connect & amp; Usr / and amp; Password @ & amp; Amp; And make dbname table report 1 (product_code VARCHAR2 (30), test_inc NUMBER (20,2));  

or you can use here to end the exit of the document SQL file to eliminate the requirement:

  $ ORACLE_HOME / bin / sqlplus / nolog & lt; & Lt; Here $ $ {sql_test};  

Share and Enjoy


Comments