I am having problems finding the RETURN value from a stored procedure call in DB2. I DO NOT want to add an OUT parameter, I want to use the RETURN statements. I have been trying to find a solution for the past couple of hours and the last thing I found was that I need to use the GET DIAGNOSTICS and SQLERRD(1). However, DB2 does not know what SQLERRD is. The last time I was told to use SQLERRD() to get the number of rows affected by a calll I actually had to use the ROW_COUNT variable.
Is there an equivalent for use here?
Is there an equivalent for use here?
Code:
CREATE PROCEDURE IS_ROOM_UNIQUE (
IN "P_CUSTOMER_NM" VARCHAR(50),
IN "P_ROOM_NM" VARCHAR(32) )
READS SQL DATA
BEGIN
DECLARE SQLSTATE CHAR(5);
DECLARE FOUND_IT INTEGER;
CALL IS_ROOM_IN_INVENTORY(P_CUSTOMER_NM, P_ROOM_NM);
GET DIAGNOSTICS FOUND_IT = ???;
IF FOUND_IT > 0 THEN
RETURN FOUND_IT;
END IF;
CALL IS_ROOM_IN_ACTIVE_ORDERS(P_CUSTOMER_NM, P_ROOM_NM);
GET DIAGNOSTICS FOUND_IT = ???;
IF FOUND_IT > 0 THEN
RETURN FOUND_IT * 10;
END IF;
RETURN 0;
END;