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 string type Name 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 field (of the string type) should be equal to concatenation of strings that are contained in the fields DAY, MONTH and YEAR.

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 field of string type should not be equal to the COUNT string, case insensitive.

LENGTH

Syntax

LENGTH(string)

Description

The LENGTH function returns the length of a string in symbols.

Example

LENGTH(NAME) < 15

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

SUBSTR

Syntax

SUBSTR(string, a[ ,b])

Description

The SUBSTR returns a segment of the string, starting from the symbol that has the number A 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, the NULL value 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 cannot start with the DIR string.

INSTR

Syntax

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

Description

The INSTR returns position where a string2 enters a string1. The string1 is checked from left to the right starting from position A. 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 into the string1. If the string2 is not found based on the specified a and b, the function return 0.

Example

INSTR(NAME, 'DIR')

The Name field cannot contain the DIR substring.

LPAD

Syntax

LPAD(string1, x[, string2])

Description

The LPAD function returns a string1 complemented at the left with symbols from a string2 to the length x. If the string2 contains less than x symbols it is duplicated. If the string2 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 field FULL_NAME.

RPAD

Syntax

RPAD(string1, x[, string2])

Description

The RPAD function returns a string1 complemented at the right with symbols from a string2 to the length x. If the string2 contains less than x symbols it is duplicated. If the string2 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 field FULL_NAME.

LTRIM

Syntax

LTRIM(string1[, string2])

Description

The LTRIM function returns the string1 with removed left symbols occurring in the string2. By default the string2 is equal to a single space character. This function checks the string1 starting from the leftmost position. When it meets the first character not occurring in the 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, the string2 is equal to a single space character. The function checks the string1 starting from the rightmost position. When it meets the first character not occurring in the 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 string DIR.

See also:

Built-in SQL Functions | Table Constraints