Don't use the exit code - it makes it impossible to check for actual errors.
I've done the pro*c method, but then it becomes very static - one program for each request.
The FOR method loop over all the output from the entire sqlplus session (hence the -s option to prevent disconnected messages), but will only store the final value. It actually sets the variable on every line, overwriting whatever it had before, so only the last one is actually captured. If you need multiple rows, you could play around with the FOR command and try to set the variables as i_#, where # increments. If you do it, please send it back for me. The FOR command can also be used to break the output line into multiple vars: output="123/abc/9-sep-04", you could set the delim to "/", and then DO (set x=%%i ) ; (set y=%%j) ; (set z=%%k)
(not sure about the parens and semicolons, didn't have time to fully test)
If you need multiple lines of output captured, you could spool it to a file, and then use that file to set the variables. Spool a file that actually has the SET commands in it, then just execute the file after you exit sqlplus.