Skip to content

Allow sub-routines to access variables/parameters defined at the outer/parent level [CORE4449] #4769

@firebird-automations

Description

@firebird-automations

Submitted by: Volker Rehn (vr2_s18)

SP with 2 sub-procedures. sub1 and sub2 don't see anything from their outer scope, no params and no other sub-procedures declared in test. sub1 of course uses its own input param i. To reproduce uncomment lines in sub2.

CREATE PROCEDURE TEST (
I INTEGER
)
RETURNS (
O VARCHAR(100)
)
AS
declare outer_var int;
declare procedure sub1 (i varchar(20)) returns (out varchar(20)) as
begin
out = i;
suspend;
end
declare procedure sub2 returns (out int) as
begin
-- out = :i;
-- out = :outer_var;
out = 2;
suspend;
end
begin
outer_var = 1;
select out from sub1('xx') into :o;
suspend;
select out from sub2 into :o;
suspend;
end;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions