Shell script to connect to Oracle

May 1, 2012 at 23:23:22
Specs: CentOS
I'm developing a script using bash to comnnect to Oracle and execute some SQL queries.

I found this answer given by Nails,

http://www.computing.net/answers/pr...

But I have some doubts in the code. Can anyone please tell me what the SET HEADING OFF, SET PAGESIZE 0 and the REPFOOTER OFF values denote?

Are these values part of the syntax ?

i.e., Is it mandatory to set these values at the time of declaring the connection string ?

Or are they optional ?

Please Help.


See More: Shell script to connect to Oracle

Report •

#1
May 2, 2012 at 09:09:18
The SET options are entirely optional - none of them are required. I typically want raw data that is pipe symbol delimited so my sqlplus queries look like this:

$ORACLE_HOME/bin/sqlplus -S "login stuff" << EOF
SPOOL mydatafile.txt;
SET HEADING OFF
SET MARKUP HTML OFF
SET PAGESIZE 0
SET echo off
SET EMBEDDED OFF
REPFOOTER OFF
SET RECSEP OFF
SET SERVEROUTPUT OFF
SET FEEDBACK OFF
SET WRAP ON
SET TRIMSPOOL ON
SET TAB OFF
select joid||'|'||job_col||'|'||col_type from jobs;
exit;
EOF

This link is a good sqlplus command reference:

http://docs.oracle.com/cd/B10501_01...


Report •
Related Solutions


Ask Question