Solved

Loop doesnot EXIT on condition

Posted on 2006-06-28
4
1,559 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

Suggested Solutions

Title # Comments Views Activity
add more rows to hierarchy 3 46
making a message body variable from an oracle select statement 4 50
Migration from sql server to oracle 5 50
oracle query 4 30
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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

734 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