Subject Re: Procedure parameter mismatch
Author nols_smit
> You forgot to specify RETURNING_VALUES clause.
> But are you sure you want to use that procedure as executable
instead of selectable ?
>
> Ivan
I changed the execute statement to the following and it compiles Ok
but with execution errors. I actually want a selectable recursive
procedure to display all the records in a branch of a treeview.
Referring to the example database: EMPLOYEE
How would one create a selectable procedure to list all the
departments under, and including Engineering (Dept_No = 600). It must
display the following result using a parameter of 600:

600 Engineering
620 Software Products Div.
621 Software Development
622 Quality Assurance
623 Customer Support
670 Consumer Electronics Div.
671 Research and Development
672 Customer Services

My trial follows:
CREATE PROCEDURE SHOW_DEPARTMENTS (
DNO CHAR (3) CHARACTER SET NONE)
RETURNS (
DEPARTMENT_NO CHAR (3) CHARACTER SET NONE,
DEPARTMENT_NAME CHAR (25) CHARACTER SET NONE)
AS
DECLARE VARIABLE rdno CHAR(3);
DECLARE VARIABLE cnt INTEGER;
BEGIN
SELECT Dept_No FROM department WHERE dept_no = :dno
INTO :rdno;

SELECT count(Dept_No) FROM department WHERE head_dept = :dno
INTO :cnt;

IF (cnt = 0) THEN
SUSPEND;

FOR SELECT dept_no, Department FROM department WHERE
head_dept = :dno
INTO :Department_No, :Department_Name
DO
BEGIN
EXECUTE PROCEDURE SHOW_DEPARTMENTS (rdno)
RETURNING_VALUES :Department_No, :Department_Name;
END

SUSPEND;
END