Versions available for this page: CUBRID 8.3.0 | CUBRID 8.3.1 | CUBRID 8.4.0 | CUBRID 8.4.1 | CUBRID 8.4.3 | CUBRID 9.0.0 |
The FORMAT function displays the number x by using digit grouping symbol as thousands delimiters, so that its format becomes '#,###,###.#####’ and performs rounding after the decimal symbol to express as many as dec digits after it. The return value is a VARCHAR type.
Cipher identifier and decimal point symbol is output in the format according to the specified language. The language used is the language specified in the intl_number_lang system parameter. When the value of intl_number_lang is not set, the language specified in the CUBRID_LANG environment variable is used. For example, when the language is one of the European languages, such as "de_DE" or "fr_FR" is interpreted as the cipher identifier and "," as the decimal point symbol (see Default output of number by language of the TO_CHAR Function (number).
FORMAT ( x , dec )
The following example shows command execution by setting the value of the intl_number_lang system parameter to "en_US".
SELECT FORMAT(12000.123456,3), FORMAT(12000.123456,0);
format(12000.123456, 3) format(12000.123456, 0)
============================================
'12,000.123' '12,000'
The following example shows command execution on the database by setting the value of the intl_number_lang system parameter to "de_DE". In the number output format of most European countries, such as Germany and France, "." is the cipher identifier and "," is the decimal point symbol.
SELECT FORMAT(12000.123456,3), FORMAT(12000.123456,0);
format(12000.123456, 3) format(12000.123456, 0)
============================================
'12.000,123' '12.000'