|
Sybernet / Supplied Functions Reference
Release 3.00 Oct 14, 2002 |
|
This function returns an integer representing the starting position of the first occurrence of pattern in the specified character expression, zero if pattern is not found. The '%' wildcard character must precede and follow pattern, except when searching for first or last characters.
FUNCTION PATINDEX
(
PATTERN VARCHAR2
, STRING VARCHAR2
)
RETURN NUMBER;
| Parameter | Description |
|---|---|
pattern |
The pattern in string that you are searching for. |
string |
The string to be searched. |
The one-relative position where this pattern was found or 0 if not found.
You can include special symbols for matching character strings. The following table describes those symbols:
| Symbols | Meaning |
|---|---|
| % | Matches any string of zero or more characters |
| _ | Matches any one character |
| [specifier] | Brackets enclose ranges or sets, such as [a-f] or [abcdef]. specifier may take two forms: rangespec1 - rangespec2: rangespec1 indicates the start of a range of characters.set: can be comprised of any discrete set of values, in any order, such as [a2bR]. Note that the range [a-f], and the sets [abcdef] and [fcbdae] will return the same set of values. | [^specifier] | caret (^) preceding a specifier indicates non-inclusion. [^a-f] means "not in the range a-f"; [^a2bR] means "not a, 2, b, or R." |
Examples