How to exit a SP?

Database
Enthusiast

How to exit a SP?

Hi All,

    How to exit an SP in a midway if some conditions are met? is LEAVE the only option? Also in SP manual states that if leave is used all the open cursors will be closed in that block, if so is there some other means by which we can exit the SP midway without closing the cursors?

Tags (2)
4 REPLIES
Enthusiast

Re: How to exit a SP?

Are you trying to build some LOOPs inside the Stored Procedure?

Enthusiast

Re: How to exit a SP?

No looping constructs, only conditional checking.

Senior Apprentice

Re: How to exit a SP?

You want to return a result set from the SP?

In that case you should be able to LEAVE, because AFAIK this only closes real cursors.

Dieter

Enthusiast

Re: How to exit a SP?

Yes Dieter, i want to retun a resultset; And leave is workign fine and returnign the resultsets.

Thanks all :)