I want to code in such way that constant declarations are reusable and so can be called by other packages. Are both methods shown below OK or is one preferred over the other due to performance, security considerations etc.?
To me method 1 is sufficient because it is takes the minimum amount of code and I don't see any security or performance problems it, when it is called in other packages.
I like to know your opinions on this.
(1.)
CREATE OR REPLACE PACKAGE konstant IS
k_GasAppCode CONSTANT VARCHAR2(32767) := 'GasAppln';
END konstant;
(2.)
CREATE OR REPLACE PACKAGE konstant IS
FUNCTION k_GasAppCode RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (k_GasAppCode, WNDS, RNDS, WNPS, RNPS) ;
END konstant;
CREATE OR REPLACE PACKAGE BODY konstant IS
FUNCTION k_GasAppCode RETURN VARCHAR2 AS
BEGIN
RETURN 'GasAppln';
END ;
END konstant;