Oracle9i SQL Reference
Release 1 (9.0.1)

Part Number A90125-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Functions, 60 of 166


LENGTH

Syntax

length::=


Text description of functions140a.gif follows
Text description of length

Purpose

The length functions return the length of char. LENGTH calculates length using characters as defined by the input character set. LENGTHB uses bytes instead of characters. LENGTHC uses unicode complete characters. LENGTH2 uses UCS2 codepoints. LENGTH4 uses UCS4 codepoints..

char can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is of datatype NUMBER. If char has datatype CHAR, the length includes all trailing blanks. If char is null, this function returns null.

Example

The following examples use the LENGTH function using single- and multibyte database character set.

SELECT LENGTH('CANDIDE') "Length in characters"
   FROM DUAL;
 
Length in characters
--------------------
                   7

This example assumes a double-byte database character set.

SELECT LENGTHB ('CANDIDE') "Length in bytes"
     FROM DUAL;
 
Length in bytes
---------------
             14

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback