0

following script is stored in file myscript

when i run it as oracle from UNIX CLI :

$./myscript 1234 2345

it does not show any output, but when i run the commands individually on the SQL prompt, they run fine and produce output.

can anyone help, why no output from UNIX CLI?

#!/bin/ksh
startDt=$1
endDt=$2
sqlplus mysqlroot/mysqlroot <<EOF >/dev/null
        SET TRIMOUT ON;
        SET FEEDBACK  OFF;
        SET PAGESIZE  0;
        SET VERIFY    OFF;
        set linesize 2300;
        set colsep |;
    select * from my_sales where saleTIME >= $startDt and saleTIME<= $endDt;
        exit;
EOF
1
  • 1
    Get rid of >/dev/null. Commented Sep 2, 2014 at 5:39

1 Answer 1

3
sqlplus mysqlroot/mysqlroot <<EOF >/dev/null
    blah blah blah
EOF

You're sending the standard output to the /dev/null device, the "bit bucket" where everything is thrown away.

This is best illustrated with the following transcript, where redirecting to /dev/null causes output to not appear:

pax> echo xyzzy >/dev/null
pax> echo xyzzy
xyzzy
pax> _

If you don't want it thrown away, just remove that output redirection:

sqlplus mysqlroot/mysqlroot <<EOF
    blah blah blah
EOF
Sign up to request clarification or add additional context in comments.

1 Comment

thank you. sometimes it is right in front of you and you miss it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.