![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| return DB2 SQLCODE | kjaisan | Shell Programming and Scripting | 0 | 11-16-2005 10:00 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to get SQLCODE ?
Suppose I am executing a sql query thru shell script.
DB : IBM DB2 Quote:
If rows > 0 are fetched, I will be getting the sqlcode as 0 Can any one help me how to get this SQL code in unix shell script (in KSH) Krishnakanth |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I don't know the syntax with "WITH", only with "WHERE", etc.
If you db2 SQL query finds at least 1 row, the returncode of your command will be 0, if not it is 1 or at least > 0. So you can work with testing $? or parse whatever SQL code you are getting by putting your command into a variable maybe like for example Code:
VAR=`db2 "select something from sometable..."` |
|||
| Google The UNIX and Linux Forums |