In a procedure if my first query returns null value or returns no records then my second query has to run even the second query returns null value or returns no records then a default value has to return. how to make this procedure? should i use if else statement or exception handler?
Share
One way of doing this would be to nest IF statements, something like this:
It is a bit clunky but it does the job.
Suppressing the NO_DATA_FOUND exception is not usually recommended practice but I think it fits this scenario: not finding the first QUEUE_ID is part of the regular business logic rather than an exception which needs to be handled. I don’t think nesting the subsequent selects in the exception handler is nearly as expressive of the business rules.