Subject Input/Output parameters
Author todd_pinel
I'm wondering if it is safe to use a local variable as both the input
and the output variable to a stored procedure?

ie) Inside a stored proc. I call a couple embedded procedures that
could set a key or not and then return the new value

CREATE PROCEDURE SP_TEST
RETURNS (
USEDKEY_NO INTEGER)
AS
DECLARE VARIABLE LUSEDKEY_NO INTEGER;
BEGIN
LUSEDKEY_NO = NULL;

EXECUTE PROCEDURE SP_TEST2(:LUSEDKEY_NO)
RETURNING_VALUES(:LUSEDKEY_NO);

EXECUTE PROCEDURE SP_TEST3(:LUSEDKEY_NO)
RETURNING_VALUES(:LUSEDKEY_NO);

USEDKEY_NO = LUSEDKEY_NO;
END

so if test2 used the key, then it would set and return it and then it
could be used in the next stored proc.

I couldn't find any reason why not but just wanted to make sure before
I start using code like that.