How can I error handling in SQLPlus , printing out customised messages when an error is encountered. I have put my code below.
My Code
#!/bin/bash
echo "My Scripts run below"
sqlplus -S UID1/UID2@DB1<< EOF
whenever sqlerror exit sql.sqlcode;
@/path/Script1
@/path/Script2
exit;
EOF
echo "My Scripts have run"
Output
My Scripts run below
SP2-0310: unable to open file "/path/Script1.sql"
SP2-0310: unable to open file "/path/Script2.sql"
My Scripts have run
Required Output
My Scripts run below
**Below error in Script1**
SP2-0310: unable to open file "/path/Script1.sql"
**Below error in Script2**
SP2-0310: unable to open file "/path/Script2.sql"
My Scripts have run