Home » Developer & Programmer » Forms » A text_io problem: ORA-302000
icon10.gif  A text_io problem: ORA-302000 [message #287292] Tue, 11 December 2007 20:14 Go to next message
anyoneokay
Messages: 10
Registered: September 2007
Junior Member
Hi,all:
I have 2 apps on form.
The first one is to read from file, and the second is to write on the file.
Firstly, i have created the file on the server, and the file(abc.txt)'s permission is rwxr--r--.
Then i tested the first one, it can read from file well.
But when i tested the second, it throwed a exception: ORA-302000.
I was so confused. why it can read from file with text_io, but can not write?

Can anyone help me to solve this problem, Thanks so much.

Here's my code:

1.WHEN-BUTTON-PRESSED(to write): works fine
-------------------------------------------------------------------------------
DECLARE
		out_file     text_io.file_type;
		line_bufer   varchar2(80);
		lv_strtmp    varchar2(100);
		lv_content   varchar2(100);
		errnum NUMBER := ERROR_CODE; 
		errtxt VARCHAR2(80) := ERROR_TEXT; 
		errtyp VARCHAR2(3) := ERROR_TYPE; 
BEGIN
	  message('111',acknowledge);
		out_file := text_io.fopen('/home/cn01278/abc.txt', 'w');
		message('222',acknowledge);
		text_io.put('123');
		text_io.new_line;
		text_io.put_line(out_file, 'abcd...');
	  text_io.fclose(out_file);
END;


2.WHEN-BUTTON-PRESSED(to read): thown an exception
-------------------------------------------------------------------------------
DECLARE
	in_file text_io.file_type;
	line_bufer   varchar2(80);
	lv_strtmp    varchar2(100);
	errnum NUMBER 			:= ERROR_CODE; 
	errtxt VARCHAR2(80) := ERROR_TEXT; 
	errtyp VARCHAR2(3) 	:= ERROR_TYPE; 
BEGIN
	in_file := text_io.fopen('/home/cn01278/abc.txt', 'r');
	text_io.Get_Line(in_file,line_bufer);
	lv_strtmp := substr(line_bufer, 1,10);
	:blk_text.txt_content := :blk_text.txt_read_err || lv_strtmp; 
	text_io.Fclose(in_file);
END;



3.ON-ERROR Trigger
-----------------------------------------------------------------------------------
DECLARE 
	errnum NUMBER := ERROR_CODE; 
	errtxt VARCHAR2(80) := ERROR_TEXT; 
	errtyp VARCHAR2(3) := ERROR_TYPE; 
BEGIN 
  message('error:',acknowledge);
	Message(errtyp||'-'||TO_CHAR(errnum)||': '||errtxt,acknowledge); 
	--:blk_text.txt_err := errtyp||'-'||TO_CHAR(errnum)||': '||errtxt;
	text_io.fclose(out_file);
	RAISE Form_Trigger_Failure; 
END;

[mod-edit]Added code tags, do so yourself next time.

[Updated on: Wed, 12 December 2007 01:56] by Moderator

Report message to a moderator

Re: A text_io problem: ORA-302000 [message #288920 is a reply to message #287292] Wed, 19 December 2007 01:09 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What version of Forms are you running? Have you defined the directory as writable in the database? Look at 'utl_file_dir' in 'v$parameter'.

David
Previous Topic: pre - form trigger
Next Topic: how to run query in from
Goto Forum:
  


Current Time: Thu Dec 08 04:18:03 CST 2016

Total time taken to generate the page: 0.09995 seconds