Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Call sql script from UNIX shell script

$
0
0
I know this question is out there in many forums, but I tried all the combinations in vain.

I'm basically trying to call a sql script from a shell script.

Below is my sql script (plsql.sql)

DELCARE
v_empno NUMBER := '&empno';
BEGIN
select ename,sal from emp where empno = v_empno;
dbms_output.put_line('Inside the plsql file');
END;

This is my unix shell script - I'm caling the plsql.sql file with the parameter passed(97882). I don't get any output. at least I should be able to view the dbms output if not for the sql query inside the sql script.

#!/usr/bin/ksh
sqlplus -s sam/olo01 << HERE
@plsql.sql 97882;
HERE


What am I missing here ? It doesn't seem to work. I tried removing the <<HERE condition, but it when executing the shell script, it keeps prompting for an input(I am not sure why) and never returns the control to the bash screen(-bash-3.2-$)

Viewing all articles
Browse latest Browse all 16232

Trending Articles