DSQL, PSQL

    Syntax

    Result type

    INTEGER

    Description

    Notes
    • With arguments of type CHAR, this function returns the formal string length (i.e. the declared length of a field or variable). If you want to obtain the “logical” length, not counting the trailing spaces, right- the argument before passing it to CHAR[ACTER]_LENGTH.

    • support: Since Firebird 2.1, this function fully supports text BLOBs of any length and character set.

    Examples

    1. select char_length('Hello!') from rdb$database
    2. -- returns 6
    3. -- returns 8
    4. select char_length
    5. from rdb$database
    6. select char_length
    7. (cast (_iso8859_1 'Grüß di!' as char(24) character set utf8))
    8. from rdb$database
    9. -- returns 24: all 24 CHAR positions count

    BIT_LENGTH(),