Help needed with error code..

Hi Guys,

I have a script which is inserting records in the table. The insert query has 0 rows to be inserted. because of that a warning is being thrown. But the return code of the insert query is showing as 1.

Is it like when a warning comes, the return code will be 1?
However, the same script is running fine with different family codes even though it is having 0 rows to be updated.

can u people help me out with this..

I am pasting the part of the code causing problem....

db2 "insert into table \
(col,,,,\
) \
select * from tab1 a, tab2 b where\
a.id=b.id \
with ur"

STAGESUM_RC=`echo $?`
if [[ $STAGESUM_RC != "0" ]] ; then
ReturntoParent $STAGESUM_RC "Error in Insert Fact Stage_Sum"
fi
db2 "commit"


In the log i can see the insert statement is executed and the warning is appearing but after that, the return code is 1 which is terminating the script..

Thanks for ur help in advance,
Magesh

This isn't really a scripting question so much as a DB2 question, because the return codes for different error or warning conditions while executing DB2 are entirely defined by DB2.

Perhaps if you check the DB2 documentation it will describe what codes are returned under what conditions, and thereby allow you modify your shell script to handle them appropriately. Maybe it would be safe for you to ignore error code 1, and only report other error codes.