Originally posted by pando
I want to avoid create files that is where the problem arises

I dont want to spool, I want to pass directly to $?

I have a method which works for PL/SQL but not for pure SQL :(
In this case awk won't help either since it requires file to do its task.

You need a good shell script adv programmer that can manipulate
the underlying source code that controls metacharacters such as this $?.