View Full Version : SQL*Plus results without additional information
Ralf Zwanziger
09-08-2004, 11:46 PM
I'm trying to spool a select result into a file on unix. To do that, I
have a shell script with the following line:
....
sqlplus scott/tiger@database < create.sql > /dev/null
....
and an additional file "create.sql" with the following commands:
set pagesize 0
set linesize 200
set serveroutput off
set heading off
spool MyResults
SELECT Data FROM OutputTable;
spool off
This works, but my "MyResults"-File does not only contain the selected
rows. First line of output is "SQL> " followed by the select
statement.
And the file ends with a blank line, a line saying "87 rows selected",
another blank line and a line containing "SQL> spool off".
Is it possible to avoid the additional four lines at the end of my
result and the first line with the sql command?
Of course I could do some "grep -v" in my shell script after the
MyResults is created, but I think there must be a better way,
to avoid the "garbage lines" when doing the select.
Greetings,
Ralf
il pazzo
09-09-2004, 02:11 AM
use
sqlplus scott/tiger@database @create.sql > /dev/null
or
sqlplus -s scott/tiger@database < create.sql > /dev/null
instead of
sqlplus scott/tiger@database < create.sql > /dev/null
"Ralf Zwanziger" <ralf_on_duty@gmx.de> ha scritto nel messaggio
news:0120k0lebd1qlvk4gs035gfrdgoud19fmm@4ax.com... I'm trying to spool a select result into a file on unix. To do that, I have a shell script with the following line: ... sqlplus scott/tiger@database < create.sql > /dev/null ... and an additional file "create.sql" with the following commands: set pagesize 0 set linesize 200 set serveroutput off set heading off spool MyResults SELECT Data FROM OutputTable; spool off This works, but my "MyResults"-File does not only contain the selected rows. First line of output is "SQL> " followed by the select statement. And the file ends with a blank line, a line saying "87 rows selected", another blank line and a line containing "SQL> spool off". Is it possible to avoid the additional four lines at the end of my result and the first line with the sql command? Of course I could do some "grep -v" in my shell script after the MyResults is created, but I think there must be a better way, to avoid the "garbage lines" when doing the select. Greetings, Ralf
Ralf Zwanziger
09-09-2004, 02:35 AM
>sqlplus -s scott/tiger@database < create.sql > /dev/null
Jupp - the "-s" option works fine.
Thanks a lot!
Bye,
Ralf
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.