Implementation of Oracle database to improve query result readability

Source: Internet
Author: User

There are many formatting tools in the Oracle database to improve the readability of the results. Our database design and software development are well-rounded.

For example, it is an employee salary table in the employee salary management module. This table looks perfect to outsiders. However, there are still many improvements.

  

1. Add the local currency symbol before the currency.

The currency field is a complex field in the system. Especially in some management systems that involve multiple currencies, sometimes the two fields have the same number, but the actually expressed amount is inconsistent. Because the two correspond to different currency symbols. Therefore, sometimes we want to display the local currency symbol before the currency field. This allows users to intuitively understand the monetary amount expressed in the standard currency.

  

For example, we want to display the currency symbol before the currency. This is obviously more readable than the above result. In fact, it is very easy to achieve this goal. The Format command is provided in the Oracle database to Format the query results. To implement the above results, you can use this command.

Column heading format L9999.99;

Column is a command provided by the Oracle database. The Format parameter can be used to Format the query result. In L9999.99, L indicates that the local currency symbol is displayed before the numeric field. The local currency symbol refers to the local currency symbol set in the Oracle database environment, which is irrelevant to the foreground application. When developing the front-end program, you must synchronize with the Oracle database. If you set the base currency in the front-end application software to RMB, the front-end program should be able to reset the local currency of the Oracle database. In this case, the L parameter can be used to display the correct results.

Parameter 9 indicates that leading 0 is forbidden to be displayed on numeric fields. In addition, it has an additional function, that is, to express the accuracy. In the preceding example, adding two 9 decimal points indicates that two decimal places are reserved. Even if there are no decimal places, add 0. This is also a common method when formatting the query results.

However, when 9 is used to limit the numerical precision, you must pay attention to the problem that the number of digits must be sufficient. If the actual value of a field is 350000, And the provided parameter is L9999.99. In the end, the correct result is not displayed. ###### May be used to replace the final result. This is a problem that requires attention during database design.

Ii. Other Format control related to Format.

Format also provides some other useful parameters.

For example, $ parameter. Change the column heading format L9999.99 command slightly. If column heading format $9999.99 is used, what is the result? At this time, no matter what the local currency symbol of the Oracle database is, in the actual results, it is a currency starting with $. That is to say, the meaning of this parameter is to display the dollar sign before the numeric field. This is irrelevant to the environment variables of the Oracle database.

  

For example, in Oracle databases, numeric data types are not distinguished by thousands of delimiters by default. In software design, especially the management software of the financial department, thousands of delimiters are often used for Division. This makes it easier for users to read data. Therefore, a comma (,) parameter is provided in the Oracle database ). This parameter specifies that thousands of delimiters are added to the numeric data.

  • 1
  • 2
  • Next Page

Related Article

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.