The UTL_RAW system package provides SQL functions that are used to manipulate RAW data types.
This package is essential because common SQL functions do not manipulate RAW data, while PL does not support overloading between RAW and CHAR data types.
The UTL_RAW package can also be used in other environments in addition to the database environment, and is therefore prefixed with UTL instead of DBMS.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Considerations
UTL_RAW allows a RAW “record” to consist of many elements. By using the RAW data type, character set conversion will not be performed. This keeps the RAW in its original format when being transferred through remote procedure calls (RPCs).
Subprograms
The following table describes the UTL_RAW subprograms supported by the current OceanBase Database version.
| Subprogram | Description |
|---|---|
| BIT_AND | Performs the bitwise logical AND operation on values in RAW r1 and RAW r2 and returns the result RAW of the AND operation. |
| BIT_COMPLEMENT | Performs the bitwise logical COMPLEMENT operation on values in RAW r and returns the result RAW of the COMPLEMENT operation. |
| BIT_OR | Performs the bitwise logical OR operation on values in RAW r1 and RAW r2 and returns the result RAW of the OR operation. |
| BIT_XOR | Performs the bitwise logical XOR operation on values in RAW r1 and RAW r2 and returns the result RAW of the XOR operation. |
| CAST_FROM_BINARY_DOUBLE | Returns a BINARY_DOUBLE value in the binary RAW representation. |
| CAST_FROM_BINARY_FLOAT | Returns a BINARY_FLOAT value in the binary RAW representation. |
| CAST_FROM_BINARY_INTEGER | Returns a BINARY_INTEGER value in the binary RAW representation. |
| CAST_FROM_NUMBER | Returns a NUMBER value in the binary RAW representation. |
| CAST_TO_BINARY_DOUBLE | Converts a BINARY_DOUBLE value in the binary RAW representation to a BINARY_DOUBLE value. |
| CAST_TO_BINARY_FLOAT | Converts a BINARY_FLOAT value in the binary RAW representation to a BINARY_FLOAT value. |
| CAST_TO_BINARY_INTEGER | Converts a BINARY_INTEGER value in the binary RAW representation into a BINARY_INTEGER value. |
| CAST_TO_NUMBER | Converts a NUMBER value in the binary RAW representation to a NUMBER value. |
| CAST_TO_RAW | Converts a VARCHAR2 value into a RAW value. |
| CAST_TO_VARCHAR2 | Converts a RAW value into a VARCHAR2 value. |
| COPIES | Returns n concatenated copies of r. |
| COMPARE | Compares RAW r1 and RAW r2. |
| CONCAT | Concatenates a maximum of 12 RAWs into one RAW. |
| LENGTH | Returns the length of RAW r in bytes. |
| REVERSE | Reverses the sequence of bytes in RAW r from end to end. |
| SUBSTR | Returns len bytes starting from pos in RAW r. |