Solved

Loop doesnot EXIT on condition

Posted on 2006-06-28
4
1,557 Views
Last Modified: 2012-08-14
F11 UTL_FILE.FILE_TYPE;
s1 varchar2(200);

LOOP

      utl_file.get_line(F11,s1);
      IF s1 IS NULL THEN
      EXIT;
      else
dbms_output.put_line(s1);

end if;
end loop;

This loop doesnot EXIT when s is NULL it countinue and throw error
ORA-01403: no data found
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 656

It is very urgent please tell me the solution data file is as follows


"Ctd","DOC1","COE:  CLOSE"
"Ctd","DOC2","X"
"Ctd","DOC3","red"
"Ctd",1/2/1990,17.24
0
Comment
Question by:avi_ny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
sathyagiri earned 500 total points
ID: 17006233
Use this
F11 UTL_FILE.FILE_TYPE;
s1 varchar2(200);

LOOP
begin
  utl_file.get_line(F11,s1);
  dbms_output.put_line(s1);
exception
  when no_data_found then
  exit;
end;
end if;
end loop;

0
 
LVL 9

Expert Comment

by:neo9414
ID: 17006324
remove the end if from your pl/sql

it should be

F11 UTL_FILE.FILE_TYPE;
s1 varchar2(200);

LOOP
begin
  utl_file.get_line(F11,s1);
  dbms_output.put_line(s1);
exception
  when no_data_found then
  exit;
end;
end loop;

0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17006341
oops i made a typo.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 17007294
F11 UTL_FILE.FILE_TYPE;
s1 varchar2(200);

LOOP
      s1 := NULL;
      utl_file.get_line(F11,s1);
      exit when s1 IS NULL;
      dbms_output.put_line(s1);
 
end loop;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question