Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Oracle + Unix question , Error validation for SQL statements in ""coprocess"" ?.

Oracle + Unix question , Error validation for SQL statements in ""coprocess"" ?.

From: Ranjeesh K R. <ranjeeshk_at_infics.com>
Date: Wed, 21 Jul 2004 00:18:00 +0530
Message-ID: <A70AE049E81A6A40879D5DC0AC8C38C9ADD61D@venus.infics.com>


Hi,

Thanks a lot for your responses . But somehow people mis understood my = question, I was asking about if i "implement co process" to the = following code what to do for error validations . for eg :..a sample = test code

for the following code=20

sqlplus -s uid/pwd |&
print -p "whenever OSERROR exit 1;"
print -p "whenever SQLERROR exit 2;"
echo $?"sql" >> /home/etladm/test/out.txt print -p "select sysdate into datval from dual;" echo $? "xxx " >> /home/etladm/test/out.txt print -p "select sysdate into datval from dual;" >> = /home/etladm/test/out.txt
echo $?"select " >> /home/etladm/test/out.txt echo $datval "value" >> /home/etladm/test/out.txt print -p "exit"
while read -p LINE # Get the co-process output do
print - ${LINE}
echo ${LINE} >> /home/etladm/test/out.txt done

output is

0sql
0 xxx
0select
value
select sysdate into datval from dual
cop.ksh find.txt grep.txt out.txt out.txt:w wi040625.xml ERROR at line 1:
ORA-00905: missing keyword

all are zero , even though it is getting errored out. Any idea on how to = resolve this?. This is just a test code , I want to implement "co = process" with error validation for the following code.

with thanks and regards=20
Ranjeesh K R=20


Hi,

If I use co process in a shell script , what is the best way to do the =
error validation of the execution of any sql statements . I was trying =
to change the following code to make use of co process concept. When I =
tried echo $? after the execution of a "wrong statements" it is still giving Zero output ( meaning success)=20
<<<<<<<<<<<<<<<<<<<<<<<<<<<

cat ${CFG_DIR}/srs_indx.lst | egrep -v '^#' | egrep -v '^[ ]*$' | = while read x
do

..

echo " Processing values :: pre $pre tbl $tbl indx $indx tblspc $tblspc = cols $cols param $param" >> ${LOGS_DIR}/srs_indx.log

sqlplus ${BIZSTG} << EOT >> ${LOGS_DIR}/srs_indx.log set verify on timing on term on echo on feedback on serveroutput on

WHENEVER SQLERROR CONTINUE
drop index $indx;

WHENEVER SQLERROR EXIT FAILURE
alter session set query_rewrite_enabled =3D true; create $pre index $indx on $tbl ($cols)
tablespace $tblspc
$param;
exit
EOT RC=3D$?
if ( test $RC -ne 0 )
then

        ERR_MSG=3D"ERROR in creating index $indx for table $tbl from = srs_indx.ksh of $ENVIR : $APP by `whoami`@`hostname` on `date` "

	echo $ERR_MSG >> ${LOGS_DIR}/srs_indx.log
	process_warning ${LOGS_DIR}/srs_indx.log
	exitstat=3D1
else
	echo "$indx created at `date`" >> ${LOGS_DIR}/srs_indx.log
fi
done                                 =20


>>>>>>>>>>>>>>>>>>>>

Any help will be appreciated .

with thanks and regards=20
Ranjeesh K R=20



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Tue Jul 20 2004 - 13:41:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US