Firebird Documentation IndexFirebird 2.0.6 Release Notes → New Features for Text Data
Firebird Home Firebird Home Prev: Optimizer ImprovementsFirebird Documentation IndexUp: Firebird 2.0.6 Release NotesNext: New INTL Interface for Non-ASCII Character Sets

New Features for Text Data

Table of Contents

New String Functions
New INTL Interface for Non-ASCII Character Sets

New String Functions

Two new string functions were added:

LOWER()

A. dos Santos Fernandes

LOWER() returns the input argument converted to all lower-case characters.

Example

isql -q -ch dos850

SQL> create database 'test.fdb';
SQL> create table t (c char(1) character set dos850);
SQL> insert into t values ('A');
SQL> insert into t values ('E');
SQL> insert into t values ('Á');;
SQL> insert into t values ('É');
SQL>
C      LOWER
====== ======
A      a
E      e
Á      á
É      é
    

TRIM()

A. dos Santos Fernandes

TRIM trims characters (default: blanks) from the left and/or right of a string.

Syntax Pattern

TRIM <left paren> [ [ <trim specification> ] [ <trim character> ]
  FROM ] <value expression> <right paren>

   <trim specification> ::=  LEADING  | TRAILING  | BOTH

   <trim character> ::= <value expression>
    

Rules

  1. If <trim specification> is not specified, BOTH is assumed.

  2. If <trim character> is not specified, ' ' is assumed.

  3. If <trim specification> and/or <trim character> is specified, FROM should be specified.

  4. If <trim specification> and <trim character> is not specified, FROM should not be specified.

Examples

A)

  select
    rdb$relation_name,
    trim(leading 'RDB$' from rdb$relation_name)
  from rdb$relations
    where rdb$relation_name starting with 'RDB$';
    

B)

  select
    trim(rdb$relation_name) || ' is a system table'
  from rdb$relations
    where rdb$system_flag = 1;
    

New String Size Functions

A. dos Santos Fernandes

Three new functions will return information about the size of strings:

  1. BIT_LENGTH returns the length of a string in bits

  2. CHAR_LENGTH/CHARACTER_LENGTH returns the length of a string in characters

  3. OCTET_LENGTH returns the length of a string in bytes

Syntax Pattern

These three functions share a similar syntax pattern, as follows.-

<length function> ::=
{ BIT_LENGTH | CHAR_LENGTH | CHARACTER_LENGTH | OCTET_LENGTH } ( <value expression> <)
    

Example

  select
    rdb$relation_name,
    char_length(rdb$relation_name),
    char_length(trim(rdb$relation_name))
  from rdb$relations;
    
Prev: Optimizer ImprovementsFirebird Documentation IndexUp: Firebird 2.0.6 Release NotesNext: New INTL Interface for Non-ASCII Character Sets
Firebird Documentation IndexFirebird 2.0.6 Release Notes → New Features for Text Data