QuestionQ22

VerifiedUsing Single-Row Functions to Customize Output

The PRODUCT_INFORMATION table includes a UNIT_PRICE column with the data type NUMBER(8,2).

Evaluate the following SQL statement:

SELECT TO_CHAR(unit_price, '$9,999') FROM product_information;  

Which two statements are correct about the output?

Choose two
Explanation

Oracle number format models round values to the precision represented by the model. Because $9,999 has no decimal element, 1023.95 is rounded and displayed as $1,024. A value of 10235.95 rounds to 10,236, which requires more integer digits than the four digit positions in the model; Oracle replaces an unrepresentable value with pound signs. The output width includes the sign position and format characters, producing #######.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!