Home » Developer & Programmer » Forms » how to create a txt file from PL/SQL procedure (oracle 10g)
how to create a txt file from PL/SQL procedure [message #341269] Mon, 18 August 2008 02:05 Go to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
Hi,

I have a procedure that contains a varchar2 variable,now i need to create a text file in from procedure and move varchar2 content into the file.

Can any one help?

Thanks in advance

Re: how to create a txt file from PL/SQL procedure [message #341278 is a reply to message #341269] Mon, 18 August 2008 02:42 Go to previous messageGo to next message
gurupatham
Messages: 66
Registered: March 2008
Location: Chennai
Member

You Can use Text_Io package to create text file in front end. In Stored procedure we can use utl_file package.

Ex:

Declare
	out_File Text_Io.File_Type;
begin
	out_File := Text_Io.FOpen('C:\test.txt' , 'W');
	Text_Io.Put_Line(out_file , 'Hi this is text file!');
	Text_Io.FClose(out_file);
end;
Re: how to create a txt file from PL/SQL procedure [message #341322 is a reply to message #341278] Mon, 18 August 2008 06:26 Go to previous messageGo to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
Thank you very mush..
Re: how to create a txt file from PL/SQL procedure [message #341332 is a reply to message #341278] Mon, 18 August 2008 07:07 Go to previous messageGo to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
Hi Gurupatham,

I am getting the error.
ORA-06550
PlS-00201:identifier 'TEXT_IO.FILE_TYPE' must be declared

for more info i have attached error message.
Re: how to create a txt file from PL/SQL procedure [message #341336 is a reply to message #341269] Mon, 18 August 2008 07:20 Go to previous messageGo to next message
gurupatham
Messages: 66
Registered: March 2008
Location: Chennai
Member
Given Example does not work in database environment(Stored Procedure). it Works only in form.
For Stored Procedure Use utl_File Package .

Ex:

Declare
	out_File Utl_File.File_Type;
begin
	out_File := Utl_File.FOpen('Dir' , 'test.txt' , 'W');
	Utl_File.Put_Line(out_file , 'Hi this is text file!');
	Utl_File.FClose(out_file);
	Exception when others then
	Dbms_output.Put_line(Sqlerrm||'-------'||Sqlcode);
end;

[Updated on: Mon, 18 August 2008 07:22]

Report message to a moderator

Re: how to create a txt file from PL/SQL procedure [message #341343 is a reply to message #341336] Mon, 18 August 2008 07:34 Go to previous messageGo to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
may i know how to give Dir path?I am getting "ORA-29280: invalid directory path--------29280" error.
Re: how to create a txt file from PL/SQL procedure [message #341354 is a reply to message #341336] Mon, 18 August 2008 08:59 Go to previous messageGo to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
Hi,

I am using oracle client.I need to create text file in my system using Utl_File.File_Type.how to give dir path?
Re: how to create a txt file from PL/SQL procedure [message #341456 is a reply to message #341354] Mon, 18 August 2008 21:36 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Do you want to use a different directory for different files or the same directory all the time?

David
Re: how to create a txt file from PL/SQL procedure [message #341474 is a reply to message #341456] Tue, 19 August 2008 00:07 Go to previous messageGo to next message
bsathishmca
Messages: 9
Registered: April 2006
Location: covai
Junior Member
Same dir for all files.but i need to create that dir in my sys not at server.(Server not accessable).
Re: how to create a txt file from PL/SQL procedure [message #341491 is a reply to message #341474] Tue, 19 August 2008 01:40 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Then use 'client_text_io'. Read about webutil in help.

David
Previous Topic: download Demo
Next Topic: Outlook calendar
Goto Forum:
  


Current Time: Fri Dec 09 13:48:02 CST 2016

Total time taken to generate the page: 0.06590 seconds