Re: [Q/H]: Exception handlers in PL/SQL

From: Alvin W. Law <alaw_at_oracle.com>
Date: Fri, 11 Mar 1994 07:49:40 GMT
Message-ID: <ALAW.94Mar10234940_at_ap221sun.oracle.com>


In article <1994Feb28.193049.25714_at_KYnug.org> Neil Greene <neil_at_kynug.org> writes:
>
> I have a cursor that evaluates insert conditions for each record in a
> table. However, some records may not meet the requirements of the table
> restraints when the cursor attempts to complete various inserts, causing
> the cursor to "wig" out with either an unhandeled exception error or some
> other problem.
>
> I am familiar with the exception error handlers and with exception
> "others". But, how can I get the exception handler to simply trap any
> errors and move the cursor to the next available record with a
> fetchrecord. All I want to do is skip the current record and move on to
> the next one.

Wrap the block of PL/SQL with a subblock and trap your exception there...

BEGIN     <some PL/SQL block>

    BEGIN         <PL/SQL block for which you want to trap error>

    EXCEPTION

        WHEN <whatever exception> THEN
            NULL;
        WHEN OTHERS THEN
            RAISE;

    END IF;     <some more PL/SQL block>

EXCEPTION
    WHEN ..... END; In the subblock exception handler, you can basically trap any or all exceptions.

--
 Alvin W. Law .............................................. Oracle Corporation
 Senior Applications Engineer ..................... 300 Oracle Parkway, Floor 6
 Manufacturing Applications .......................... Redwood Shores, CA 94065
 Email: alaw_at_oracle.com ........... Voice: 1.415.506.3390 . Fax: 1.415.506.7299

ORA-03113: end-of-file on communication channel
Received on Fri Mar 11 1994 - 08:49:40 CET

Original text of this message