Help needed with error code..


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed with error code..
# 1  
Old 12-11-2008
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
# 2  
Old 12-11-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

RPM Install error: libc.so.6 is needed by

I have an application rpm which when installed is failing to get installed with error error: Failed dependencies: libc.so.6 is needed by testSam-4.7.x86_64 libc.so.6(GLIBC_2.0) is needed by testSam-4.7.x86_64 libc.so.6(GLIBC_2.1) is needed by testSam-4.7.x86_64 ... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

2. Shell Programming and Scripting

Value Too Great for Base Error, Explanation and Workout needed

Hey Friends, its me again! :o I was asked to create a script that would go into our backup directories and delete/purge anything in the directory after a certain amount of days, normally I would be able to write something up that goes to the directory finds it and deletes it. cd... (12 Replies)
Discussion started by: gkelly1117
12 Replies

3. Shell Programming and Scripting

Code needed to get sql queries

Hi i need code to get sql queries through a shell script for a text file input which contain the service ids iputfile I-H-2048-10GB-M I-H-4096-12GB-M I-H-2048-p1000-M the code should contain below queries among which service_id is replacable with value from input file. ... (4 Replies)
Discussion started by: surender reddy
4 Replies

4. Red Hat

KSH script help needed ( nice error trap routine ?)

I am running a script that runs a loop and executes a command on ${i} until the end of the for loop. From time to time the command generates an error ( which is good) for example ERROR0005: How can I trap the error and send an email echoing the ${i} variable in the loop and the error ? ... (2 Replies)
Discussion started by: pcpinkerton
2 Replies

5. Shell Programming and Scripting

Help needed with error handling

I am writing a wrapper to one of the .ksh script. The wrapper script should capture the error/fatal(if any) and exit out of the script. Here is the script: #!/bin/sh . main_script.ksh <arg1> <arg2> > mainscript.log 2>&1 cnt=`grep 'ERROR' -c mainscript.log` if ; then echo "Error" ... (6 Replies)
Discussion started by: stunnerz_84
6 Replies

6. Shell Programming and Scripting

Error running the script.... Help needed. Please

I have another Question: I tried to run the following script: (I actually wanted to print out the second field in the text field.) #!/usr/bin/ksh set -x readfile=/dir1/data.txt cat $readfile | while read line do x = `echo $line|awk '{print $2}'` echo $x done But, it shows the... (3 Replies)
Discussion started by: ss3944
3 Replies

7. Shell Programming and Scripting

Script needed to align java/c/C++ code

Hi All, Does anyone has script to align java/c/c++ code? or pls advice I need it very badly...... :-( Thanks in advance (4 Replies)
Discussion started by: askumarece
4 Replies

8. UNIX Desktop Questions & Answers

Help needed tracing source of bash error

Issue resolved: The 'culprit file' was .bash_aliases. It had the naughty  (ASCII for the octal string Bash was detecting and returning an error about). I cleaned it up in Pico (see my post to the thread on favorite editors if you want background on why I use Pico/Nano), re-sourced it via... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

9. UNIX for Dummies Questions & Answers

Find and Replace code help needed

I have a file "dbshot.xml" that contains lines that need replacing in a batch format but the parameters are based on two lines. Ex. <role roletype="01"> <status>1 needs to be changed to <role roletype="01"> <status>0 I can't use simply "<status>1" replace since the... (2 Replies)
Discussion started by: E Orgill
2 Replies
Login or Register to Ask a Question