Subject Re: Exception handling
Author fantomen66
Hi Regina,

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;
> EXIT;
> END^
> SET TERM ; ^
>
> You can also read on DataDef.pdf about this. Hope it helps!
>
> Regards,
> Regina Phandu