Greetings!
I have to convert a shell script from Oracle to db2. My Oracle script looks something like this
This will output "03-OCT-11" (Oracle sysdate). My db2 script looks like this
It works but does not retrieve the date ; only "0" or "1" (true/false). How can I retrieve the date from my Db2 query result??
I have to convert a shell script from Oracle to db2. My Oracle script looks something like this
Code:
#!/bin/bash OUT=`$ORACLE_HOME/bin/sqlplus -s user/pass@instance << EOF WHENEVER SQLERROR EXIT FAILURE ROLLBACK SET HEADING OFF SET FEEDBACK OFF SET PAGES 0 select sysdate from dual; exit success EOF` echo $OUT
Code:
#!/bin/bash db2bin="/users/db2inst1/sqllib/bin" #connect $db2bin/db2 connect to myschema; #query $db2bin/db2 "SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1 WITH UR "; #debug echo $? #check if [ $? = "0" ] then echo "found-do something" else echo "not found-good bye" fi #terminate $db2bin/db2 quit;
Comment