Firebird Documentation Index → Firebird 2.0.6 Release Notes → New Features for Text Data |
Table of Contents
Two new string functions were added:
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 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
If <trim specification> is not specified, BOTH is assumed.
If <trim character> is not specified, ' ' is assumed.
If <trim specification> and/or <trim character> is specified, FROM should be specified.
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;
Three new functions will return information about the size of strings:
BIT_LENGTH returns the length of a string in bits
CHAR_LENGTH/CHARACTER_LENGTH returns the length of a string in characters
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;
Firebird Documentation Index → Firebird 2.0.6 Release Notes → New Features for Text Data |