Select length(-1) from dual What is the output of the above sql stmt
-
0
-
1
-
2
-
error
The LENGTH function in Oracle/SQL counts the number of characters in a string expression, including special characters and signs. For LENGTH(-1), the function treats '-1' as a two-character string (minus sign and digit 1), not as a numeric value. The output is 2, not 1 (the digit count) or 0. This demonstrates that LENGTH operates on string representation, not mathematical values.
In Oracle SQL, LENGTH() operates on the string representation of its argument. The numeric literal -1 is implicitly converted to the string "-1", which has 2 characters (the minus sign and the digit 1), so LENGTH(-1) returns 2. It does not return an error or treat the minus sign as excluded from the character count.