Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLPlus output within bash script

oscrubSep 22 2010 — edited Sep 27 2010
Hey everyone, I wasn't sure if this should go here or in the SQL forum or the Linux forum, but here goes:

Using Oracle10g on Linux, I'm using a bash script to run an sql script, but when I try to echo the results, it shows the output in a single line.

Here's the script
USERLIST=`sqlplus -s  / AS SYSDBA <<EOF
   set head off
   set verify off
   set feedback off
   SELECT username from dba_users;
   exit;
EOF
`
echo $USERLIST;
And here's the output:
oracle@apps scripts]$ ./userl.sh
PAYROLL HR2 CORE DEMO TIMEKEEPING SYS EXPENSE 
Is there anyway so that the output can be shown with line breaks, where all the output is not on one line? I understand I can spool to a file using the spool command, however I'd like to try and get it working this way first.

Any help would be much appreciated, thanks.

Edited by: oscrub on Sep 22, 2010 6:46 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2010
Added on Sep 22 2010
5 comments
5,008 views