Quote:
Originally Posted by llsmith
Here's a quick example of an easy way to do it:
SQLCODE=0
SQLCODE=`db2 -ec +o "update db cfg for $DBNAME using dbheap 11370"`;
if [ $SQLCODE -ne 0 ]
then
echo " "
echo "Error: Failed to Update Db Cfg for $DBNAME"
echo "Error: SQLCODE = $SQLCODE"
exit 1
|
Dear Sir,
I followed above script to prepare my ksh script with minor change, it always said the line "if [ $SQLCODE -ne 0 ]" is not vallid, and the return status = 0.
My ksh script as below.
db2 "set serveroutput on"
SQLCODE=0
SQLCODE=`db2 -td/ +o -f abc.sql`;
if [ $SQLCODE -eq 0 ]
then
echo "sucess"
exit 0
else
echo "failed"
exit 1
fi
-------------------------------
In abc.sql,
BEGIN
declare v_count integer;
open cursor
loop
fetch xx into xx;
.....
set v_count = v_count + 1
update abc set no_of_count = v_count where ....
call dbms_output.put_line(v_count);
end loop
close cursor
END
/
What wrong of the script ? Please kindly help.