A text_io problem: ORA-302000 [message #287292] |
Tue, 11 December 2007 20:14 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS 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
|
|
|