Situation : I'm trying to run an Oracle Stored procedure from a Linux shell script. I created a .sql file called my_procedure.sql as shown below:
set serveroutput on
set serveroutput off
DECLARE
my_variable NUMBER(10);
BEGIN
exec schema.my_procedure();
END;
/
EXIT
The above .sql file is in turn called from a simple shell script called myscript.sh like this:
sqlplus -s /@connection_sid @my_procedure
Problem: When I execute sh myscript.sh
, it throws an error in the my_procedure.sql file as below:
Encountered the symbol 'schema' when expecting one of the following
:= . ( @ % ;
What I've tried so far : I guess-worked by removing the exec keyword. Then I tried using username.schema.myprocedure, but nothing worked.
This procedure runs fine from the command line thus:
sqlplus -s username/password <<END
exec myprocedure();
END;
Any suggestions for this shall be very helpful.