This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
dev:sql:functions:character_length [2010/07/08 17:05] els created |
dev:sql:functions:character_length [2010/07/09 20:06] els |
||
---|---|---|---|
Line 1: | Line 1: | ||
{{page>:top_add&nofooter&noeditbtn}} | {{page>:top_add&nofooter&noeditbtn}} | ||
{{page>:sql_bar&nofooter&noeditbtn}} | {{page>:sql_bar&nofooter&noeditbtn}} | ||
+ | |||
+ | |||
====== Omnidex SQL Function: CHARACTER_LENGTH ====== | ====== Omnidex SQL Function: CHARACTER_LENGTH ====== | ||
===== Description ===== | ===== Description ===== | ||
- | The CHARACTER_LENGTH function returns the number of characters in a string. The number returned is a 4-byte integer. The abbreviation, CHAR_LENGTH, is supported as a synonym for CHARACTER_LENGTH. | + | The CHARACTER_LENGTH function returns the number of characters in a string. The abbreviation, CHAR_LENGTH, is supported as a synonym for CHARACTER_LENGTH. |
CHARACTER_LENGTH should not be confused with $DATA_LENGTH and $COLUMN_LENGTH. $DATA_LENGTH returns the number of characters plus the null-terminator for C STRING datatypes. $COLUMN_LENGTH returns the length of the column as declared in the table. | CHARACTER_LENGTH should not be confused with $DATA_LENGTH and $COLUMN_LENGTH. $DATA_LENGTH returns the number of characters plus the null-terminator for C STRING datatypes. $COLUMN_LENGTH returns the length of the column as declared in the table. | ||
+ | |||
+ | This function returns an INTEGER datatype. | ||
===== Syntax ===== | ===== Syntax ===== | ||
Line 15: | Line 19: | ||
===== Examples ===== | ===== Examples ===== | ||
==== Example 1: Column ==== | ==== Example 1: Column ==== | ||
- | <code SQL> | + | <code> |
> select name, character_length(name) len from individuals; | > select name, character_length(name) len from individuals; | ||
Line 30: | Line 34: | ||
</code> | </code> | ||
- | ==== Example 2: Quoted String ==== | + | ==== Example 2: Character Expression ==== |
- | <code SQL> | + | <code> |
> select gender, name, char_length(gender || name) len from individuals; | > select gender, name, char_length(gender || name) len from individuals; | ||
Line 45: | Line 49: | ||
</code> | </code> | ||
+ | ====== Additional Resources ====== | ||
+ | |||
+ | See also: | ||
+ | {{page>dev:sql:functions:see_also_string&nofooter&noeditbtn&noheader}} | ||
{{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} |