I'd like a code sample.
I'm tryng this:
DECLARE
var NUMBER;
BEGIN
/*N.B. for loop variables in pl/sql are new declarations, with scope only inside the loop */
FOR var IN 0 .. 10 LOOP
DBMS_OUTPUT.put_line(var);
END LOOP;
IF (var IS NULL) THEN
DBMS_OUTPUT.put_line('var is null');
ELSE
DBMS_OUTPUT.put_line('var is not null');
END IF;
END;
and getting no output (though I know it's not a infinite loop). Why is this one not printing?
edit: The not-printing code was fixed via the database manager interface.
A LOOP without an EXIT statement is one way to generate an infinite loop in PL/SQL
BEGIN
LOOP
null;
END LOOP;
END;
You could also write a WHILE loop that never ends
BEGIN
WHILE( true )
LOOP
NULL;
END LOOP;
END;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With