Home > Database > Oracle > length usage in oracle

length usage in oracle

下次还敢
Release: 2024-04-30 07:00:28
Original
1203 people have browsed it

The LENGTH function returns the number of characters in a string. It accepts CHAR, VARCHAR2, NCHAR, and NVARCHAR2 data types as input, ignores whitespace, and returns an integer result.

length usage in oracle

Usage of LENGTH function in Oracle

LENGTH functionReturns the characters of string data number. It has the following format:

<code>LENGTH(string_expression)</code>
Copy after login

where:

  • string_expression is the string expression whose length is to be found.

Syntax

The LENGTH function accepts the following data types as input:

  • CHAR
  • VARCHAR2
  • NCHAR
  • NVARCHAR2

Return value

LENGTH function returns an integer representing the number of characters in the string.

Example

The following example shows how to use the LENGTH function:

<code class="sql">SELECT LENGTH('Hello World') FROM dual;</code>
Copy after login

Output:

<code>10</code>
Copy after login

In the above example, LENGTH The function returns the number of characters in the string 'Hello World', which is 10.

Note

  • LENGTH function does not consider spaces.
  • The LENGTH function ignores trailing spaces.
  • If string_expression is NULL, the LENGTH function returns NULL.

The above is the detailed content of length usage in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template