Home  >  Article  >  Database  >  length usage in oracle

length usage in oracle

下次还敢
下次还敢Original
2024-04-30 07:00:281146browse

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>

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>

Output:

<code>10</code>

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!

Statement:
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
Previous article:casewhen usage in oracleNext article:casewhen usage in oracle