This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:sql:functions:contains:home [2011/01/23 23:18] els |
dev:sql:functions:contains:home [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 5: | Line 5: | ||
===== SQL Functions: $CONTAINS ====== | ===== SQL Functions: $CONTAINS ====== | ||
- | **[[dev:sql:functions:contains:home|Overview]]** | | + | **[[dev:sql:functions:contains:home|Description]]** | |
[[dev:sql:functions:contains:syntax|Syntax]] | | [[dev:sql:functions:contains:syntax|Syntax]] | | ||
- | [[dev:sql:functions:contains:Customization]] | | + | [[dev:sql:functions:contains:customization|Customization]] | |
[[dev:sql:functions:contains:examples|Examples]] | [[dev:sql:functions:contains:examples|Examples]] | ||
Line 21: | Line 21: | ||
This function returns a BOOLEAN datatype and can only be referenced in the WHERE clause of a SELECT statement. | This function returns a BOOLEAN datatype and can only be referenced in the WHERE clause of a SELECT statement. | ||
- | |||
- | ===== Syntax ==== | ||
- | CHAR[ACTER]_LENGTH ( character_expression ) | ||
- | |||
- | == character_expression == | ||
- | Required. Any expression that returns a character-class datatype. Examples of expressions are columns, concatenations of columns, literal strings and functions that return a character datatype. | ||
- | |||
- | ==== Examples ==== | ||
- | === Example 1: Column === | ||
- | <code> | ||
- | > select name, character_length(name) len from individuals; | ||
- | |||
- | NAME LEN | ||
- | -------------------------------------------------- ----------- | ||
- | MS. MARY LEWIS 14 | ||
- | MRS. ALICE R TOLLIVER 21 | ||
- | MR. SIDNEY K TOLLIVER 21 | ||
- | MRS. JENNIFER J HOPKINS 23 | ||
- | MR. CHARLIE HOPKINS 19 | ||
- | MS. KIMBERLY BLUE 17 | ||
- | KATHLEEN TUCKER 15 | ||
- | |||
- | </code> | ||
- | |||
- | === Example 2: Character Expression === | ||
- | <code> | ||
- | > select gender, name, char_length(gender || name) len from individuals; | ||
- | |||
- | G NAME LEN | ||
- | - -------------------------------------------------- ----------- | ||
- | F MS. MARY LEWIS 15 | ||
- | F MRS. ALICE R TOLLIVER 22 | ||
- | M MR. SIDNEY K TOLLIVER 22 | ||
- | F MRS. JENNIFER J HOPKINS 24 | ||
- | M MR. CHARLIE HOPKINS 20 | ||
- | F MS. KIMBERLY BLUE 18 | ||
- | F KATHLEEN TUCKER 16 | ||
- | |||
- | </code> | ||
==== ==== | ==== ==== |