jack
jack

Reputation: 163

SQL script cshell

I am doing this in my cshell script sqlplus $ORA_UID/$ORA_PSWD @${SQL}test.sql ${DATA}${ext1}thats trying to get output from test.sql script.. in my sql script i am dumping output to spool &1 .. but when i run my script my files are blank i am not getting anything from database.. can someone tell what wrong with this

Upvotes: 1

Views: 759

Answers (1)

user123664
user123664

Reputation:

normally it is not a good idea to have your userid and password displayed in the processlist, as is happening now. Most of the times when sql scripts don't produce the expected output it is because the end of SQL marker is missing. Default the end of SQL is the ';' Reading the end of SQL marker actually starts the SQL statement. First try the script with feedback on and check the error message in the spoolfile. Is the spoolfile location OK ?

sqlplus /nolog <<eof
connect $ORA_UID/$ORA_PSWD
@${SQL}test.sql ${DATA}${ext1}
eof

This construction prevents the display of the credentials on the processlist.

In the sqlscript could be

select * from dual;

or

select * from dual
/

but each and every SQL statement has to have an end of SQL marker.

Upvotes: 1

Related Questions