Subject | Exception handling |
---|---|
Author | fantomen66 |
Post date | 2002-11-21T12:22:02Z |
I have creatd the following store procedure:
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;
EXIT;
END^
SET TERM ; ^
What i actually want to do is to control if the count on colum
(PERSNR) > 20 then
initiate a exception called SANGER displaying the following
message 'No more beds'
How should i change my current store procedure and also have the
exception inside the stored procedure.
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;
EXIT;
END^
SET TERM ; ^
What i actually want to do is to control if the count on colum
(PERSNR) > 20 then
initiate a exception called SANGER displaying the following
message 'No more beds'
How should i change my current store procedure and also have the
exception inside the stored procedure.