Re: SPL: How to react to NOTFOUND
Posted in 1997
Richard Spitz <spitz@ana.med.uni-muenchen.de> wrote: :Hi, : :in a Stored Procedure, I have an implicit cursor with FOREACH. However, :it is possible that the SELECT statement returns no rows, and in that :case, :I want to have a completely different action. : :I tried catching the NOTFOUND with ON EXCEPTION IN (100), but it seems :that NOTFOUND doesn't raise an exception at all. Is that correct? How :can :I find out in my procedure whether the SELECT returned a NOTFOUND? NOTFOUND is not an exception so it doesn't rais an exception as you have found. What I have done is to use a counter variable. I set it to 0 before the foreach and increas it by 1 inside the foreach. If it's still 0 after the foreach I take the alternate action. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org