User Profile

Collapse

Profile Sidebar

Collapse
Alan Simpson
Alan Simpson
Last Activity: Dec 19 '11, 09:09 PM
Joined: Oct 3 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Alan Simpson
    replied to capture db2 output in shell script
    in DB2
    I figured it out: the trick is to use /dev/null.
    Code:
        #!/bin/bash
        DB2INSTANCE=db2inst1
        BIN="/users/db2inst1/sqllib/bin"
        OUT=`${BIN}/db2 connect to myschema > /dev/null 
        ${BIN}/db2 -x "SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1 WITH UR"
        ${BIN}/db2 quit > /dev/null
        `
        echo $OUT

    Hope this helps.
    See more | Go to post

    Leave a comment:


  • Alan Simpson
    started a topic capture db2 output in shell script
    in DB2

    capture db2 output in shell script

    Greetings!

    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
    This will output "03-OCT-11"...
    See more | Go to post
No activity results to display
Show More
Working...