Multiple choice technology databases

What will be Output of the following query? select length(to_char('9999','999999.99')) from dual

  1. 9

  2. 10

  3. 4

  4. 8

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The format mask '999999.99' in Oracle TO_CHAR specifies 6 digits before decimal (with leading spaces for smaller numbers) and 2 digits after decimal. Converting string '9999' with this mask produces ' 9999.00' which is 10 characters total: 2 leading spaces, 4 digits, decimal point, and 2 decimal digits. The LENGTH function returns 10.