Home » SQL & PL/SQL » SQL & PL/SQL » Do While Loops
Do While Loops [message #28002] Tue, 18 November 2003 21:06 Go to next message
Lisa Irnita
Messages: 2
Registered: November 2003
Junior Member
I am having a problem to use do while loops. Does PL/SQL has this function?

If yes how to do it?

My problem is to do this item:

Do <process> While counter <=3

If counter > 3 then, process halted
Re: Do While Loops [message #28003 is a reply to message #28002] Tue, 18 November 2003 22:52 Go to previous message
Daljit Singh
Messages: 290
Registered: October 2003
Location: Texas
Senior Member
Hi,

Well if u want to implement entry control loop then u can use:

declare
a number:=1;
begin
loop
exit when a >3;
dbms_output.put_line(a);
a:=a+1;
end loop;

if will show u
1
2
3

And if u want to impelment exit control loop then u can use :

declare
a number:=4;
begin
loop
dbms_output.put_line(a);
a:=a+1;
exit when a <= 3;
end loop;

Thanx.

if will show u

4
Previous Topic: ForAll
Next Topic: time fromat
Goto Forum:
  


Current Time: Sun Apr 27 01:11:23 CDT 2025