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!

302000 non-ORACLE exception

user626836Feb 15 2010 — edited Feb 15 2010
Hi everybody,
I have a form where I'm trying to pull the values from a .txt files and save them in my database, but I receive that error. This is what I have:
Browse button to select the file using a When_button_pressed trigger with the following code:
BEGIN

:file_name := GET_FILE_NAME('C:\', File_Filter =>' Text Files (*.txt) | *.txt | ' );

get_file_contents(file_name);

exception when others then
message(sqlerrm);

END;

I also have a procedure to play with the values inside of my .txt file which is the following:

PROCEDURE get_file_contents(filename varchar2) IS
in_file Text_IO.File_Type;
linebuf Varchar2(1000);
BEGIN
--opening the file in READ ONLY mode 'r'.
in_file := Text_IO.Fopen(filename,'r');

Text_IO.Get_Line(in_file,linebuf); --to skip the heading tittles
Text_IO.Get_Line(in_file,linebuf); --to skip the heading separators.

--Navigating to datablock
go_block('MATERIAS_ISS');

--Clear block if contents required to replaced
clear_block;
first_record;

LOOP
--Reading line into linebuf variable of varchar2 type
Text_IO.Get_Line(in_file,linebuf);

--this logic depends on the structure of your text file...play with linebuf variable
--I am reading the file as comma seperated and no of column are known in my example.

:USER_ID := substr(linebuf,1,instr(linebuf,',',1,1)-1);
:CLASS_ID := substr(linebuf,instr(linebuf,',',1,1)+1,(instr(linebuf,',',1,2)-instr(linebuf,',',1,1))-1);
:CLASS_NAME := substr(linebuf,instr(linebuf,',',1,2)+1);
:STATUS := substr(linebuf,instr(linebuf,',',1,3)+1);

next_record;
Text_IO.New_Line; --to move to next line in file

END LOOP;
EXCEPTION WHEN no_data_found THEN --when no line remains this exception will raise
Text_IO.Fclose(in_file);
first_record;


END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2010
Added on Feb 15 2010
6 comments
12,629 views