Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
The FINDBYTES function returns the byte position of the beginning of a specified group of bytes within a text expression.
Return Value
INTEGER
Syntax
FINDBYTES(text-expression, bytes [starting-pos [LINENUM]])
Arguments
The text expression in which you are searching for the specified bytes. The value of text-expression can be a multiline value. In this case, FINDBYTES searches all lines for the specified bytes. The match must be exact, including a match of upper- and lowercase characters.
The group of bytes for which you are searching. When bytes is a multiline value, FINDBYTES ignores all lines except the first one.
When bytes is not found in text-expression, FINDBYTES returns zero. When the group of bytes occurs more than once, FINDBYTES returns the position of its first occurrence.
An INTEGER expression that specifies the byte position where the search in text-expression should start. The default is at position 1 (the first byte) in text-expression.
Specifies that FINDBYTES should return the line number instead of the byte position of the beginning of the specified text.
Notes
When you are using a single-byte character set, you can use the FINDCHARS function instead of the FINDBYTES function.
This function does not accept NTEXT arguments, because it is oriented toward byte-manipulation instead of character manipulation. It always returns values of type TEXT. When you must use this function on NTEXT values, use the CONVERT or TO_CHAR function to convert the NTEXT value to TEXT.
Examples
Example 13-19 Finding the Starting Position of a Byte Group
This example shows how to find the starting position of various groups of bytes in the literal TEXT value hellotherejoe
.
The statement
SHOW FINDBYTES('hellotherejoe', 'joe')
produces the following output.
11
The statement
SHOW FINDBYTES('hellotherejoe', 'al')
produces the following output.
0