Why doesn't output display SQL statement when using sqlplus in bash script?

  • From: Nan Xiao <xiaonan830818@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Mon, 7 Mar 2016 16:08:15 +0800

Hi all,

I am writing a Bash script which using sqlplus to connect Oracle database:

#!/bin/bash

sqlplus / as sysdba <<EOF
select group#,members,bytes/1024/1024,status from v\$log;
exit
EOF


Executing it, the output is:

$ ./test.sh

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 7 02:57:57 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options

SQL>
    GROUP#    MEMBERS BYTES/1024/1024 STATUS
---------- ---------- --------------- ----------------
         1          1          102400 CURRENT
         3          1          102400 UNUSED
         2          1          102400 INACTIVE

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options


The SQL statement runs successfully. But I am curious about why the
statement doesn't display in output: There
is empty after `SQL> `.

Best Regards
Nan Xiao

Other related posts: