| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ksh scrip to include various sql commands and rownum
2004-01-19, 11:44(+01), Robert:
[...]
> exit &num_of_rows
> EOD
> # echo $?
> num_of_rows=$?
> echo "Number of rows inserted = " $num_of_rows
[...][please don't top post]
You'd better not use the exit code to return values. If sqlplus fails with an error or was killed by some signal, that won't work.
Moreover, return codes are limites to the range {0-255} (in most Unices).
You'd better use a pipe:
value=$(sqlplus ... << EOF
...
select &num_of_rows;
EOF
)
or
returnedShellScript=$(sqlplus ... << EOF
...
select concat('value1=', &num_of_rows1,
'\nvalue2=', &num_of_rows2);
EOF
)
eval "$returnedShellScript"
-- Stéphane ["Stephane.Chazelas" at "free.fr"]Received on Mon Jan 19 2004 - 05:27:44 CST
![]() |
![]() |