Home » SQL & PL/SQL » SQL & PL/SQL » Spool tables data in a text file using Stored Procedure
Spool tables data in a text file using Stored Procedure [message #205226] Fri, 24 November 2006 00:19 Go to next message
monikagupta
Messages: 8
Registered: June 2006
Junior Member
Hi All,
I have to select huge data from a table in a stored procedure,and then write that data in text files.The test file names and the data in it,should be as per one of the column values.
e.g select state_names from state;
Then separate state_names files should be created dynamically and corresponding data should go in file. I tried the following,but it is not working(it gives error on SPOOL command):

declare
state_NUM varchar2(100);
begin

SELECT state_name into state_num FROM states;
SPOOL D:\&&state_num.txt;
end;


Someone,please help!

Regards
Monika
Re: Spool tables data in a text file using Stored Procedure [message #205233 is a reply to message #205226] Fri, 24 November 2006 00:41 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
hi,

 spool is a sqlplus command.you can't use it in pl/sql block.search for utl_file.



regards,
Re: Spool tables data in a text file using Stored Procedure [message #205249 is a reply to message #205233] Fri, 24 November 2006 01:02 Go to previous message
monikagupta
Messages: 8
Registered: June 2006
Junior Member
Ok! Thanks for the information.
Previous Topic: Index Creation on Table
Next Topic: Querying data from excel sheet
Goto Forum:
  


Current Time: Fri Dec 06 01:44:13 CST 2024