Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
firebird-automations opened this issue Jun 3, 2014 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

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;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

You do not read documentation:

Limitations:
2) Currently, a subroutine may not directly access or use variables, cursors or another
subroutines of the main statements. This may be allowed in the future.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Changed case from Bug to Feature/Improvement request -- currently limitation is documented.

Changed "Summary"/Description wording to reflect change from Bug to Feature.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

issuetype: Bug [ 1 ] => New Feature [ 2 ]

summary: sub-procedures don't see outer scope => All sub-procedures to access variables/cursors defined at the outer/parent level

@asfernandes asfernandes changed the title All sub-procedures to access variables/cursors defined at the outer/parent level [CORE4449] Allow sub-procedures to access variables/cursors defined at the outer/parent level [CORE4449] Jan 4, 2022
@asfernandes asfernandes self-assigned this Jan 4, 2022
@asfernandes asfernandes changed the title Allow sub-procedures to access variables/cursors defined at the outer/parent level [CORE4449] Allow sub-routines to access variables/cursors defined at the outer/parent level [CORE4449] Jan 4, 2022
@asfernandes asfernandes changed the title Allow sub-routines to access variables/cursors defined at the outer/parent level [CORE4449] Allow sub-routines to access variables/parameters defined at the outer/parent level [CORE4449] Jan 29, 2022
asfernandes added a commit that referenced this issue Jan 30, 2022
defined at the outer/parent level [CORE4449].

Remove blr_parameter3.

Comment unused blr_run_count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment