Subject Firebird Workbench, EXECUTE Stored Procedure within another Stored Procedure.
Author Henrik Sitter
Hello,

I'm trying to execute a stored procedure within another stored
procedure. The first procedure looks like this:

SET TERM ^! ;
CREATE PROCEDURE TEST1 returns (VAR_VARETYPE VarChar(50), VAR_LEVERANDOR
VarChar(50), VAR_ADRESSE1 VarChar(50), VAR_KONTAKTPERSON VarChar(50),
VAR_TELLER Integer) AS
DECLARE VARIABLE var1 INTEGER;

BEGIN

var1 = 0;
IF (var1 = 1) THEN
BEGIN
FOR SELECT V.VARETYPE, L.LEVERANDOR, L."ADRESSE 1", L.KONTAKTPERSON
FROM VARETYPE v INNER JOIN LEVERANDOR l ON v.LEVERANDOR =
l.LEVERANDOR
WHERE (V.VARETYPE = 'Sko') OR (V.VARETYPE = 'Jakke')
ORDER BY V.VARETYPE ASC
INTO :VAR_VARETYPE, :VAR_LEVERANDOR, :VAR_ADRESSE1,
:VAR_KONTAKTPERSON
DO
BEGIN
SUSPEND;
var1 = var1 + 1;
END
END

IF (var1 = 0) THEN
BEGIN
FOR SELECT COUNT(*)
FROM LEVERANDOR
INTO :VAR_TELLER
DO
SUSPEND;
END

END ^!
SET TERM ; ^!

This is just a test procedure but it works like a charm when I execute
it in Firebird Workbench.

My second Stored procedure is:

SET TERM ^! ;
CREATE PROCEDURE TEST2 AS
BEGIN

EXECUTE PROCEDURE TEST1 ;

END ^!
SET TERM ; ^!

So my plan is simply to execute TEST1 in TEST2, but I get the following
error: "ISC ERROR MESSAGE: invalid request BLR at offset 24 parameter
mismatch for procedure TEST1"

Somebody got a clue (I'm sure there is)?

Henrik