Quote:
Originally Posted by tmarikle
I want to read whole lines back from Oracle queries so I am setting the field separator to newlines only for the WHILE..read loop. Otherwise, the read would read each word rather than the whole line. I use echo '\012' (\012 = newline) because I don't like to break up lines like this IFS='
'. I add \001 because if I use \012 by itself, it doesn't seem to stick for me.
My code is as follows
line_no=10
pro=TEST
{
echo "WHENEVER SQLERROR EXIT 1
set feedback off verify off pagesize 0
select x from tp_mquote where ct1=0; " | sqlplus -s/ /
} | while IFS=$(echo '\012\001') read LINE;
do
case ${LINE} in
ORA-*|SP2-*) echo "Hido some stuff based on Oracle error" ;;
*) echo ${LINE} ;;
esac
done
echo $?
if [ $? -ne 0 ]; then
global_proc $line_no $proc_name
else
echo Success
fi
------Now their is error in sql statement as the column in WHERE clause does not exist in that table...-------------
But before echoing that error it echoes
sql statement and then all FILE NAMES in my pwd
and after that the actual error..
1. How can i avoid those FILE name..
2. I want to write this error to file a.out.
Please help.
Thanks & Regards,
Dhananjay