Subject Re: [ib-support] Re: Exception handling
Author Martijn Tonies
Hi,

(comments below)

> I am sorry Regina, I tried to insert the if statement as you
> recomomended in your example, but I got the following error in
> interbase:
> Dynamic SQL Error
> SQL error code = -206
> Column unknown
>
> Strange enough though that if I discard the if statement there is no
> problem. I had also created the exception itself before the stored
> procedure.
>
> brgds,
> sohail
>
>
> --- In ib-support@y..., "Regina Phandu" <regina@3...> wrote:
> > You have to create exception first, like this:
> >
> > create exception sanger 'No more beds';
> > commit;
> >
> > then inside the procedure you can called it: exception sanger
> >
> > SET TERM ^ ;
> > CREATE PROCEDURE SANGPLATSER
> > (AVDID INTEGER, KON CHAR(1))
> > RETURNS
> > (TOTAL_SANGER CHAR(10))
> > AS
> > BEGIN
> > SELECT COUNT(PERSNR) FROM VY_SANGPLATSER
> > WHERE
> > AVDID = :AVDID
> > AND
> > KON = :KON
> > INTO :TOTAL_SANGER;
> > if (persnr > 20) then exception sanger;

persnr is not defined here - the value is in the TOTAL_SANGER variable.

So, IF (TOTAL_SANGER > 20)
might work...

I guess you could figure that out yourself...


With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."