Whenever Sqlerror Never Works
I don't know what can be a reason and I spent already hours on the Web trying to figure out what's wrong in my case. I've checked official documentation and some thought from Tom K
Solution 1:
Consider below generic snippet:
$ cmd1 < <(cmd2) # Or cmd1 <(cmd2)$ echo $?Here, $? is set to the exit status of cmd1. The exit status of cmd2 is lost.
In your case, sqlplus happens to be cmd2. So, the exit status of that command is not captured in $?.
You could try this;
$ sqlplus ... | cmd1$ status=(${PIPESTATUS[@]})$ for i in${status[@]}; do> [ $i -ne 0 ] && echo Exited with $i> done$ echo Exited with 0Note that if cmd1 is a complex structure (like while read e.g.) any thing you run in that while loop will be run in a subshell & any environment (variables/ pwd) changed will be lost.
Post a Comment for "Whenever Sqlerror Never Works"