Question

Below is the script I use:a

     #!/usr/bin/ksh
     echo "create table temp_a" > emptab.sql
     echo "(" >> emptab.sql
     echo "subscriber_no int" >> emptab.sql
     echo "); commit" >> emptab.sql
     sqlplus -s user/passC@db << eof
     @emptab.sql
     exit
     eof

After executing this script I don't get any printing or error. After executing the script I check if table exists by using for example "select * from temp_a", but I get an exception that table does not exist.

Please advise what is the error in my script.

Thanks in advance

Was it helpful?

Solution

 #!/usr/bin/ksh
 echo "create table temp_a" > emptab.sql
 echo "(" >> emptab.sql
 echo "subscriber_no int" >> emptab.sql
 echo ");" >> emptab.sql    #no commit
 echo "/" >> emptab.sql   #add /
 sqlplus -s user/passC@db << eof
 @emptab.sql
 exit
 eof
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top