1.

Name some predefined exceptions in PL/SQL?

Answer»

The EXIT statement is used to immediately terminate a loop. With this, the program control resumes at the next statement FOLLOWING the loop. It can also be used in a NESTED loop to stop the execution of the INNERMOST loop.

When the EXIT statement is encountered inside a loop, the loop is immediately TERMINATED and the program control resumes at the next statement following the loop.

The following is the syntax:

EXIT;

The example code:

DECLARE   val number(2) := 2; BEGIN   WHILE val < 10 LOOP      dbms_output.put_line ('value = ' || val);      val := val + 1;      IF val = 5 THEN         EXIT;      END IF;   END LOOP; END; /

The output:

value = 2 value = 3 value = 4


Discussion

No Comment Found