Length functions

Use length functions to determine the length of a character column, string, or variable, or of the value returned by a character expression, or (for CHAR_LENGTH in multibyte locales) the number of logical characters.

Read syntax diagramSkip visual syntax diagram
Length Functions

    (1)                             
|--------+-+-LENGTH-+-----------+------------------------------->
         | '-LEN----'           |   
         +-+-CHAR_LENGTH------+-+   
         | '-CHARACTER_LENGTH-' |   
         '-OCTET_LENGTH---------'   

                          (2)            
>--(--+-| Quoted String |---------+--)--------------------------|
      |  (3)   (4)                |      
      +-------------variable_name-+      
      '-+--------+--column--------'      
        '-table.-'                       

Notes:
  1. Informix® extension
  2. See Quoted String
  3. ESQL/C
  4. SPL Language
Element Description Restrictions Syntax
column Name of a column in table Must have a character data type Identifier
table Name of the table in which the specified column occurs Must exist Identifier
variable Host variable or SPL variable that contains a character string Must have a character data type See language-specific rules for names.
Each of these functions has a distinct purpose:
  • LENGTH (also known as LEN)
  • OCTET_LENGTH
  • CHAR_LENGTH (also known as CHARACTER_LENGTH)

Copyright© 2021 HCL Technologies Limited