Constants

Translation spec for Package Constants

Description

PACKAGE CONSTANTS can be declared either in the package declaration or in the PACKAGE BODY. When a package constant is used in a procedure, a new variable is declared with the same name and value as the constant, so the resulting code is pretty similar to the input.

constant CONSTANT datatype [NOT NULL] { := | DEFAULT } expression ;

Sample Source Patterns

Sample auxiliary code

create table table1(id number);

Oracle

CREATE OR REPLACE PACKAGE PKG1 AS
	PROCEDURE procedure1;
	package_constant CONSTANT NUMBER:= 9999;
END PKG1;

CREATE OR REPLACE PACKAGE BODY PKG1 AS
	PROCEDURE procedure1 AS
	BEGIN
		INSERT INTO TABLE1(ID) VALUES(package_constant);
	END;
END PKG1;

CALL PKG1.procedure1();

SELECT * FROM TABLE1;

Snowflake

Known Issues

No issues were found.

No related EWIs.

Last updated

Was this helpful?