Dear Sir,
I want to know how to return 0/-1 from sql to ksh script. My sql need to be called from unix script. Then, some checking will be proceed in sql, and return -1 if checking result is abnormal. Also, I need to display information during checking, but it doesn't work
My program as below.
in ksh.
db2 "set serveroutput on"
db2 -td/ +o -f test.sql << EOF1 2>&1
$x1
EOF1
if [ $? -eq 0 ]
then
echo 'ok'
else
echo 'failed'
fi
--------
In sql,
Begin
Declare ....
select count(*) from ....
call dbms_output.put_line(count);
if count > 0 then
return -1
else
retrurn 0
end if
end
-------------------
Please kindly to let me know what wrong of above program. Thanks !