Select Length

What value is returned after executing the following statement? 
(Choose the best answer.)

SELECT LENGTH('How_long_is_a_piece_of_string?') FROM DUAL;

A. 29
B. 30
C. 24
D. None of the above

---

Explanation:

The query SELECT LENGTH('How_long_is_a_piece_of_string?') FROM DUAL;, is using the LENGTH function in Oracle Database. This function calculates the number of characters in a given input string, including any spaces, punctuation marks, tabs, and other nonprintable special characters.

Now, when you execute this query, the value returned will be the length of the string that is provided as an argument to the LENGTH function. In this case, the argument is the string 'How_long_is_a_piece_of_string?'.

Out of the given options, the correct answer is option B, which is 30. This is because the length of the given string is 30 characters, including spaces, underscore characters, and the question mark.

Let me give you another example to help you understand this better. Let's say you have a string 'Hello, World!' and you want to find out its length using the LENGTH function. You would write the query like this:

SELECT LENGTH('Hello, World!') FROM DUAL;

When you execute this query, it will return the value 13, which is the length of the string 'Hello, World!'.

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.