In this post we will discuss how we can call sqlplus from within a unix shell script. The syntax to call a SQLPLUS from shell script is
In the syntax above,
$login is the unix variable which stores username/password.
EOF is the identifier to indicate start and end of sql statements.
UNIX variables can be referred inside sqlplus by using $ sign. Any dbms_output.put_line statements are printed in the log file if script is run through concurrent program.
sqlplus -s $login <<-EOF
set feedback off
set serveroutput on
declare
-- variable declarations
....
....
begin
--sql statements..
....
....
end;
/
exit
EOF
In the syntax above,
$login is the unix variable which stores username/password.
EOF is the identifier to indicate start and end of sql statements.
UNIX variables can be referred inside sqlplus by using $ sign. Any dbms_output.put_line statements are printed in the log file if script is run through concurrent program.
No comments:
Post a Comment