Oracle® OLAP Expression Syntax Reference Release 11.2 E23381-01 |
|
|
PDF · Mobi · ePub |
SUBSTR
returns a portion of string, beginning at a specified character position and extending a specified number of characters.
SUBSTR
calculates lengths using characters as defined by the input character set.
SUBSTRB
uses bytes instead of characters.
SUBSTRC
uses Unicode complete characters.
CHAR | NCHAR | VARCHAR2 | NVARCHAR2
{ SUBSTR | SUBSTRB | SUBSTRC }(char, position [, substring_length ])
char
is a text expression that provides the base string from which the substring is derived.
position
identifies the first character of the substring:
When position
is positive, then the function counts from the beginning of char
to find the first character.
When position
is negative, then the function counts backward from the end of char
.
When position
is 0 (zero), then the first character is the beginning of the substring.
substring_length
is the number of characters in the returned string. By default, the function returns all characters to the end of the base string. If you specify a value less than 1, then the function returns a null.
SUBSTR('firefly', 1, 4)
returns the substring fire
.
SUBSTR('firefly', -3, 3)
returns the substring fly
.