My Oracle Support Banner

How To Catch Exception Inside Cursor Loop? (Doc ID 1432897.1)

Last updated on MARCH 04, 2022

Applies to:

PL/SQL - Version 11.1.0.7 and later
Information in this document applies to any platform.

Goal

The following procedure failed to compile with the EXCEPTION inside the cursor loop. If commenting out EXCEPTION section, the procedure compiled successfully.

Question: Does Oracle support catch exception inside cursor loop? if yes, could you provide a working example?

Warning: Procedure created with compilation errors.

SQL> show error
Errors for PROCEDURE P_INSERT:

LINE/COL ERROR
-------- -----------------------------------------------------------------
19/8 PLS-00103: Encountered the symbol "EXCEPTION" when expecting one
of the following:
( begin case declare end exit for goto if loop mod null
pragma raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge

28/5 PLS-00103: Encountered the symbol "CLOSE" when expecting one of
the following:
end not pragma final instantiable order overriding static

LINE/COL ERROR
-------- -----------------------------------------------------------------
member constructor map

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.