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

Add support for Package Body Constants (or even Variables) [CORE6538] #6765

Closed
firebird-automations opened this issue Apr 15, 2021 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Anderson Farias (afarias)

Votes: 1

It would be nice to declare CONSTANTS in package body (or even variables) that could be used by all functions/procedues with in it. Eg.

RECREATE PACKAGE BODY MY_PACKAGE
AS
DECLARE MY_CONSTANT VARCHAR(10) = 'SOME VALUE';
BEGIN

FUNCTION MY_FUNCTION_A RETURNS VARCHAR(10)
AS
BEGIN
RETURN MY_CONSTANT;
END

FUNCTION MY_FUNCTION_B RETURNS VARCHAR(50)
AS
DECLARE MY_LOCAL_VAR VARCHAR(20);
BEGIN
MY_LOCAL_VAR = 'OTHER VALUE';
RETURN MY_CONSTANT || MY_LOCAL_VAR;
END

(...)

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

The workaround is to create a (deterministic) function that has no parameters and returns a constant value.

@asfernandes
Copy link
Member

Duplicates #3411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants