Home » SQL & PL/SQL » SQL & PL/SQL » ORA-01403: no data found
ORA-01403: no data found [message #292080] Mon, 07 January 2008 13:42 Go to next message
ridhi_sundar
Messages: 184
Registered: November 2007
Location: Bangalore
Senior Member
I am using utl_file to extract data from a text file. I am using the code like below.

-
-
-

loop
UTL_FILE.get_line(input_file,data);
EXIT WHEN LENGTH(data) <=0;
IF(substr(data,92,4) = '2000') THEN
Total_Invoice_Amount:=TRIM(SUBSTR(data,366,22));
utl_file.put_line (output_file,Total_Invoice_Amount);
END IF;
END LOOP;
-
-
-

at the end of file as there is no more data the line"UTL_FILE.get_line(input_file,data);" raises an exception no data found.

ORA-01403: no data found

as a result control goes to exception block & my remaining code r not geting executed.
Please help me solving this problem.
Re: ORA-01403: no data found [message #292084 is a reply to message #292080] Mon, 07 January 2008 14:00 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add an exception block to trap this exception.
begin
  your code
  begin
    loop
      utl_file.get_line
      ...
    end loop;
  exception
    when no_data_found then null;
  end;
  the rest of your code
end;

Regards
Michel
Previous Topic: dynamic flat file name (merged)
Next Topic: Error Ora -0054 in transaction
Goto Forum:
  


Current Time: Sat Dec 03 19:57:47 CST 2016

Total time taken to generate the page: 0.07483 seconds