In Oracle, the LENGTH function is used to return the length of a string in characters. Here's how you can use the LENGTH function with an example:
SELECT LENGTH('Hello World') AS string_length FROM dual;
In this example, 'Hello World' is a string literal. The LENGTH function is applied to this string, and it returns the length of the string, which is 11 characters. The FROM dual clause is used in Oracle to ensure that the query returns a result, as Oracle requires selecting from a table or a dummy table like dual.
The output of this query would be:
STRING_LENGTH
-------------
11
This demonstrates how to use the LENGTH function in Oracle to find the length of a string.
No comments:
Post a Comment