Home » SQL & PL/SQL » SQL & PL/SQL » table data into a text file
table data into a text file [message #197359] Wed, 11 October 2006 01:23 Go to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

hi friends,
I'm using oracle 8i database, there is one table with 450 rows.

i need this complete data into a text file.


please help me in this regard.




thank you very much


vinod
Re: table data into a text file [message #197362 is a reply to message #197359] Wed, 11 October 2006 01:31 Go to previous messageGo to next message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is one way to do it: spool output into the file.
SQL> spool output.txt
SQL> select empno, ename from emp;

     EMPNO ENAME
---------- ----------
      7369 SMITH
      7499 ALLEN
      7521 BURGLAR
      7566 JONES
      7654 TIGER
      7698 BLAKE
      7782 CLARK
      7788 SCOTT
      7839 KING
      7844 TURNER
      7876 ADAMS
      7900 JAMES
      7902 FORD
      7934 MILLER

14 rows selected.

SQL> spool off;
All records should now be in OUTPUT.TXT file on your disk.
Re: table data into a text file [message #197397 is a reply to message #197359] Wed, 11 October 2006 02:34 Go to previous messageGo to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

it is good but where should i get that output file?how can i find the path
Re: table data into a text file [message #197401 is a reply to message #197397] Wed, 11 October 2006 02:47 Go to previous message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
By default, it is the current (working) directory. What do you use to run SQL statements? SQL*Plus? If it is invoked directly (on MS Windows, Start -> Programs -> ... -> Oracle), file is spooled into ORACLE_HOME\BIN direcotry. If you use SQL*Plus from the operating system command prompt, file is spooled into this directory.
Previous Topic: how convert colum into row
Next Topic: want to get number of sundays in a month
Goto Forum:
  


Current Time: Tue Dec 06 10:26:09 CST 2016

Total time taken to generate the page: 0.19965 seconds