Oracle procedure-constants Application

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.