Return Code is always Zero when Calling Unix Shell Commands from 10g Version of Sqlplus
(Doc ID 552815.1)
Last updated on FEBRUARY 26, 2019
Applies to:SQL*Plus - Version 10.2.0.1 and later
Information in this document applies to any platform.
*** Checked for relevance on 26-Feb-2019 ****
Host commands from sqlplus on version 10g always returns zero not trapping the error when logged into the database without connect string (<USER>/<PASSWORD>). However, when logged into the database with connect string (<USER>/>PASSWORD>@<CONNECT_STRING>), host commands are able to trap any error and returns non-zero.
Steps to reproduce:
1. export TBL1="abcde:fghij"
2. export TBL2="ABCDE"
3. Log into database without connect string (<USER>/<PASSWORD>)
4. SQL> !print "$TBL1" | grep ":";echo $?
5. SQL> !print "$TBL2" | grep ":";echo $?
0 -> This is incorrect result, it should return 1
6. Logout and login again with connect string (<USER>/>PASSWORD>@<CONNECT_STRING>) and execute repeat steps 4 and 5 , it will return proper results.
Upgrade database from 9i or older to 10g.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document