When multiple stored procedures in Oracle use public constants, we can create a dedicated package to manage all constants. The definition example is roughly as follows:
Create or replace package global_constant is
/* Numeric constants */
/* Ratio */
Rate_tax constant number: = 1.17; -- Tax Rate
/* Integer */
Size_decimal constant number: = 8; -- the number of decimal places used by finance to save the number of decimal places
Size_percent constant number: = 4; -- two digits after the decimal point in percentage
/* Price */
Price_400 constant number: = 1800; -- 400 telephone price
/* Character constants */
Code_product constant varchar2 (20): = 'abc ';
End global_constant;
Create or replace package body global_constant is
End global_constant;
Call process: constants created in a package can only be called in functions and producedure.
Global_constant.rate_tax
Global_constant.code_product
If you are familiar with Java, you should easily integrate this method with JavaProgramThe Java file global. java used to define constants in the design is linked. Indeed, language is the same, and we need to learn ideas, so that we can continue without changing.