Text Functions

CHR

Syntax

CHR(x)

Description

The CHR function returns a character from the ASCII table for the specified x.

Example

NAME <> CHR(65)||CHR(90)

The NAME string type field should not be equal to AZ string.

CONCAT3

Syntax

CONCAT3(string1, string2, string3)

Description

The CONCAT3 function returns a string that is the result of concatenation ("adhesion") of the following strings: string1, string2 and string3.

Example

FULL_DATE = CONCAT3(DAY, MONTH, YEAR)

The FULL_DATE string type field should be equal to concatenation of strings that are contained in the DAY, MONTH and YEAR fields.

UPPER

Syntax

UPPER(string)

Description

The UPPER function returns the "string" string where all characters are displayed using the upper case. Non-letter symbols are returned unchanged.

Example

UPPER(NAME) <> 'COUNT'

The NAME string type field should not be equal to the COUNT string and case insensitive.

LENGTH

Syntax

LENGTH(string)

Description

The LENGTH function returns the string length in symbols.

Example

LENGTH(NAME) < 15

The length of the string in the NAME field cannot be more than fifteen symbols.

SUBSTR

Syntax

SUBSTR(string, a[ ,b])

Description

The SUBSTR function returns part of the string starting from the symbol that has the a number and having the length of b symbols. When a = 0, it means the same as a = 1 (the beginning of the string). By default, all symbols till the end of the string are returned if the b value is not specified. If b is less than 1, NULL is returned. If a or b is a number with floating point, its fractional part is discarded.

Example

SUBSTR(NAME, 1, 3) <> 'DIR'

The NAME field should not start with the DIR string.

INSTR

Syntax

INSTR(string1, string2[, a, b])

Description

The INSTR function returns position where the string2 substring enters the string1 string. The string1 string is checked from left to the right starting from the a position. Position of the b-th entry is returned. By default, a and b are equal to 1, thus, the function returns position of the first entry of the string2 string into the string1 string. If the string2 string is not found based on the specified a and b, the function returns 0.

Example

INSTR(NAME, 'DIR')

The NAME field cannot contain the DIR substring.

LPAD

Syntax

LPAD(string1, x[, string2])

Description

The LPAD function returns the string1 string complemented at the left with symbols from the string2 string to the length x. If the string2 string contains less than x symbols, it is duplicated. If the string2 string is not specified, a single space is used by default.

Example

LPAD(NAME, 25, S_NAME) = FULL_NAME

The NAME field complemented at the left to 25 characters from the S_NAME field should be equal to the FULL_NAME field.

RPAD

Syntax

RPAD(string1, x[, string2])

Description

The RPAD function returns the string1 string complemented at the right with symbols from the string2 string to the length x. If the string2 string contains less than x symbols, it is duplicated. If the string2 string is not specified, a single space is used by default.

Example

RPAD(NAME, 25, S_NAME) = FULL_NAME

The NAME field complemented at the right to 25 characters from the S_NAME field should be equal to the FULL_NAME field.

LTRIM

Syntax

LTRIM(string1[, string2])

Description

The LTRIM function returns the string1 string with removed left symbols occurring in the string2 string. By default, the string2 string is equal to a single space. This function checks string1 starting from the leftmost position. When it meets the first character not occurring in string2, it returns the result.

Example

LTRIM(NAME) <> 'DIR'

The NAME field with removed left spaces cannot be equal to the DIR string.

RTRIM

Syntax

RTRIM(string1[, string2])

Description

The RTRIM function returns the string1 with removed right symbols occurring in the string2. By default, string2 is equal to a single space. The function checks string1 starting from the rightmost position. When it meets the first character not occurring in string2, it returns the result.

Example

RTRIM(NAME) <> 'DIR'

The NAME field with removed right spaces cannot be equal to the DIR string.

REPLACE

Syntax

REPLACE(string, search_str[, replace_str])

Description

The REPLACE function returns the "string" string where each "search_str" is replaced with "replace_str". If the replace_str parameter has not been specified, all search_str entries are deleted.

Example

REPLACE(NAME, TXT) <> 'DIR'

The NAME field, from which all occurrences of the TXT field have been deleted, cannot be equal to the DIR string.

See also:

Built-in SQL Functions | Table Constraints