Home » SQL & PL/SQL » SQL & PL/SQL » Output in Text File
Output in Text File [message #201576] Sun, 05 November 2006 23:10 Go to next message
jadoo83
Messages: 26
Registered: October 2006
Location: Mumbai
Junior Member
hi,

I want the output of following command in text file...

select date from dual;

i used spooling but it spools commands with output and i am intrested in output only.

Jitendra
Re: Output in Text File [message #201580 is a reply to message #201576] Sun, 05 November 2006 23:24 Go to previous messageGo to next message
Admin@Lightsql.Com
Messages: 36
Registered: November 2006
Member

Try this way in sqlplus

set feedback off
set echo off
spool aa.txt
select sysdate from dual;
spool off


if you want you can add set heading off

There are few set commands you need to look into.

Good Luck.

Jayg
Fun Programming with Oracle & Visual C++, Author of lightsql
Re: Output in Text File [message #201824 is a reply to message #201580] Mon, 06 November 2006 23:09 Go to previous messageGo to next message
jadoo83
Messages: 26
Registered: October 2006
Location: Mumbai
Junior Member
hi Jaya,

I tried ur suggetion but it's not working and also it's not spooling single byte into file.

Jitendra
Re: Output in Text File [message #201825 is a reply to message #201824] Mon, 06 November 2006 23:13 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

C:\>sqlplus/nolog

SQL*Plus: Release 10.1.0.2.0 - Production on Tue Nov 7 09:10:23 2006

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

SQL> conn hr@orcl/hr
Connected.
SQL> set feedback off
SQL> set verify off
SQL> set heading off
SQL> set echo off
SQL> spool c:\test.txt
SQL> select sysdate from dual;

07-NOV-06
SQL> spool off
SQL> host type test.txt
SQL> select sysdate from dual;

07-NOV-06

SQL> spool off


hope this helps
MOhammad Taj.
Re: Output in Text File [message #201850 is a reply to message #201825] Tue, 07 November 2006 01:37 Go to previous messageGo to next message
jadoo83
Messages: 26
Registered: October 2006
Location: Mumbai
Junior Member
Hi Mohammad Taj,

I tried your solution too but i'll like to say that i am intrested only in output
example

if my select statement is

SQL> select sysdate from dual;

then instead of
SQL> select sysdate from dual;

07-NOV-06

in spooled file i want only

07-NOV-06

Jitendra
Re: Output in Text File [message #201851 is a reply to message #201850] Tue, 07 November 2006 01:38 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
SET TERMOUT OFF might help.
Tell you what: why don't you check out the SQL*Plus Reference. A link to the documentation can be found in the sticky.

MHE
Re: Output in Text File [message #201858 is a reply to message #201850] Tue, 07 November 2006 02:14 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
put the commands in a script and run that script.

eeh, that is, after you followed Maahers advice...

[Updated on: Tue, 07 November 2006 02:14]

Report message to a moderator

Previous Topic: procedures
Next Topic: ORA-04052
Goto Forum:
  


Current Time: Fri Dec 09 23:24:24 CST 2016

Total time taken to generate the page: 0.07954 seconds