[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Loop doesnot EXIT on condition

Posted on 2006-06-28
4
Medium Priority
?
1,564 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 2000 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup

650 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