Subject RE: [firebird-support] Is using SELECT COUNT (*) in a stored procedure a bad idea? (Once Again)
Author Bogdan Mugerli
SET TERM ^^ ;
CREATE PROCEDURE SPS_ACTIVITY_CODE_DEL_CHK (
V_ACTIVITY_CODE Char(1))
returns (
R_DELETE_OK SmallInt)
AS
DECLARE VARIABLE iRowCount INTEGER;
BEGIN
r_DELETE_OK = 0;

/* See if we have a ACTIVITY record association on file */
for SELECT a.activity_code
FROM ACTIVITY A
WHERE A.ACTIVITY_CODE = :v_ACTIVITY_CODE
INTO :iRowCount
do
begin
r_DELETE_OK = 1;
exit;
end
end
^^
SET TERM ; ^^

If you call this procedure with select, then add suspends on appropriate
places

Regards,
Bogdan