Trapping Errors in Stored Procedures

Trapping Errors in Stored Procedures

Post by Brian Dia » Sat, 01 May 1999 04:00:00



I have a stored procedure that is being executed by an insert trigger to
send notifications using xp_sendmail.  If xp_sendmail fails, an error is
raised and travels all the way back to the ADO object that originally made
the insert.

How can I trap the xp_sendmail errors in the stored proc so they don't make
it back to the ADO Connection?

Your help is greatly appreciated,
Brian Dial
MCSD
Intergraph Corp.
Marshall Space Flight Center

 
 
 

1. Trapping errors from stored procedure calls

We often use code in stored procedures for premature exit, such as



    BEGIN
        RAISERROR( 'Whoopsie in sub-module 3 - error %d',


    END

Another program detects that this has happened as follows:



    BEGIN
        RAISERROR( 'Whoopsie in StoredProcedure - error %d',


    END

I am wondering if this instead should be, for instance,




    BEGIN
        RAISERROR( 'Whoopsie invoking StoredProcedure - error %d',


    END

    BEGIN
        RAISERROR( 'Whoopsie during StoredProcedure - error %d',


    END

- i.e., is our current style liable to miss some errors?

(For instance, invalid parameters, before StoredProcedure even runs?)

2. XP_SDIDEBUG

3. Trapping Errors in Stored Procedures

4. discontinued support for sql7?

5. Trap errors with Store Procedures in SQL WS 6.5

6. sdfg

7. trapping errors in stored procedures (newbie)

8. More Info on DBMS Crash

9. Trapping error inside stored procedure using ON EXCEPTION

10. Trap Entended stored procedure errors in DBLIB

11. FW: trap informix store procedure errors!

12. Error trapping in stored procedure

13. Stored Procedure Error Traps