Server: UDB 8.1 solaris server
Client: Windows xp with bash installed
I am trying a simple test like this..
#!/bin/bash
Echo off
#
# Connect to DB2
#
db2 connect to sample user db2admin using db2admin
db2 -x 'call x_validation_list(?)';
echo $?
if [ $? -ne 0 ]
then
echo "*** stored procedure x_validation_list bad call"
return
fi
echo "the end..."
db2 connect reset
RESULTS
======
Got the following message at c prompt:
Echo: not found
Database Connection Information
Database server = DB2/NT 8.1.6
SQL authorization ID = DB2ADMIN
Local database alias = STGD01
SQL0440N No authorization routine named "X_VALIDATION_LIST" of type "PROCEDURE" having compatible arguments was found. SQLSTATE=42884
4
the end...
DB20000I The SQL command completed successfully
BEHAVIOUR EXPECTED
=================
I was expecting results something like this...
Echo: not found
Database Connection Information
Database server = DB2/NT 8.1.6
SQL authorization ID = DB2ADMIN
Local database alias = STGD01
SQL0440N No authorization routine named "X_VALIDATION_LIST" of type "PROCEDURE" having compatible arguments was found. SQLSTATE=42884
4
*** stored procedure x_validation_list bad call
------------------------------------------------------------
Can somebody tell me why:
1. The if coniditon echo is not being displayed - Echo ? did display 4 which is non zero
2. And the second is really corollary to the above - why did the return not work
3. RETURN in bash will prevent any statements below it to be executed - Is my understanding right?
Now the SP x_validation_list is a non-existing SP; So I was hoping that the echo "*** stored procedure x_validation_list bad call" will be displayed and RETURN will stop the script and get out - meaning I DID NOT expect echo "the end..." to display.
Thanks