Click to See Complete Forum and Search --> : How to get procedure to continue....


dbbyleo
11-22-2005, 06:26 PM
My procedure loops through (each user in the database) and does a simple task of notifying users via email using UTL_SMTP.

The problem I have come across is this:

When the user is no longer with the company, then the email address that UTL_SMTP tries to send to is invalid and the procedure exits with this error:

ERROR at line 1:
ORA-29279: SMTP permanent error: 550 5.1.1 johns@myco.com... User unknown
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 240
ORA-06512: at "my.procedure", line 96
ORA-06512: at line 1

That's understandable...

My question is: How do I make my procedure "ignore" this kind of error and have it continue through the loop and finish the procedures??

slimdave
11-23-2005, 12:59 AM
You'd need to handle that exception with an EXCEPTION clause ... http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/07_errs.htm#LNPLS007

dbbyleo
11-23-2005, 12:26 PM
READ THE DOCUMENTATION!!! (I know, I know...)
Thanks slimdave.

I know how to handle it with an exception, the problem I still have is I want it to continue with the block if this particular exception occurs.

But after reading the documentation, I learned something new... Using sub-blocks! Sub-blocks can have it's own "local" exception handlers, which would exit the sub-block, but continue the main block!

Sweeeeeet!

Thanks again! (I've bookmarked that link...)