The SUBSTR function returns len bytes, which start from pos in RAW r.
Syntax
UTL_RAW.SUBSTR (
r IN RAW,
pos IN BINARY_INTEGER,
len IN BINARY_INTEGER DEFAULT NULL)
RETURN RAW;
Parameters
| Parameter |
Description |
| r |
The RAW string from which the bytes are extracted. |
| pos |
The position in r at which the extraction begins. |
| len |
The number of bytes extracted from r starting from pos. This field is optional. |
Default values and optional parameters
| Optional parameter |
Description |
| len |
The byte length from pos to the end of r. |
Return values
| Return value |
Description |
| portion of r |
The len bytes that are extracted starting from pos. |
| NULL |
This value is returned if the input value of r is NULL. |
Usage notes
If the value of pos is a positive number, the SUBSTR function counts from the beginning of r to find the first byte. If the value of pos is a negative number, the SUBSTR function counts backward from the end of r. The value of pos cannot be 0.
If len is omitted, the SUBSTR function returns all bytes to the end of r. The value of len cannot be less than 1.
Exceptions
| Exception |
Description |
| VALUE_ERROR |
This error may be returned in the following cases:
pos is equal to 0 or greater than the length of r.
len is less than 1 or greater than r – (pos – 1).
|