Oracle® OLAP DML Reference 11g Release 2 (11.2) Part Number E17122-07 |
|
|
PDF · Mobi · ePub |
The SUBSTR functions (SUBSTR, SUBSTRB, and SUBSTRC) return a portion of string, beginning at a specified position in the string. The functions vary in how they calculate the length of the substring to return.
SUBSTR calculates lengths using characters as defined by the input character set.
SUBSTRB calculates lengths using bytes.
SUBSTRC calculates lengths using Unicode complete characters.
The return value is the same data type as string.
{SUBSTR | SUBSTRB | SUBSTRC }(char, position [, substring_length ])
A text expression that is the base string from which the substring is created.
The position at which the first character of the returned string begins.
When position is 0
(zero), then it is treated as 1
.
When position is positive, then the function counts from the beginning of string to find the first character.
When position is negative, then the function counts backward from the end of string.
The length of the returned string. SUBSTR calculates lengths using characters as defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC uses Unicode complete characters.
When you do not specify a value for this argument, then the function returns all characters to the end of string. When you specify a value that is less than 1
, the function returns NA
.