Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling sql script from shell script

FirstName_LastNameApr 25 2015 — edited Apr 25 2015

Hi,

I know this question has been asked many time in various forums, but I tried many combinations and not able to figure out what I'm missing.

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

This 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 is it I am missing ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2015
Added on Apr 25 2015
5 comments
2,450 views