The SUBSTR function returns len bytes, which start from pos in RAW r.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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. |
Considerations
If the value of
posis a positive number, theSUBSTRfunction counts from the beginning ofrto find the first byte. If the value ofposis a negative number, the SUBSTR function counts backward from the end ofr. The value ofposcannot be 0.If
lenis omitted, theSUBSTRfunction returns all bytes to the end ofr. The value oflencannot be less than 1.
Exceptions
| Exception | Description |
|---|---|
| VALUE_ERROR | This error may be returned in the following cases:
|