Running SQL Plus using EOF method in Unix shell script was not hard to write. We have seen lots of programming practice and most of the shell script will call the SQL execution via sqlplus username/password @script.sql.
This file calling method was widely used around and the programmer just need to amend the script.sql for changes.
Some programmer or System Administrator wants to maintain single file which was the Unix shell script and embed the SQL script if possible.
The following of the Unix shell script shows how we can call the SQL command by using the EOF execution method.
SQL Plus EOF Execution Method
echo "Begin SQL Plus"
sqlplus -s user/password << EOF
select count(*) from all_objects
echo "End SQL Plus"
Remember, it is not mandatory to use the word “EOF” in your shell script.
Any other word will be accepted as well such as “!” and the rule is the opening and closing word of the SQL command should be the same.
Next» Warning: Remote Host Identification Has Changed