Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A text_io problem: ORA-302000

611286Dec 11 2007 — edited Dec 11 2007
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 read): works fine
-------------------------------------------------------------------------------
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;


2.WHEN-BUTTON-PRESSED(to write): thown an exception
-------------------------------------------------------------------------------
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;


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;
-----------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2008
Added on Dec 11 2007
1 comment
5,219 views