The UTL_RAW package provides SQL functions for working with the RAW data type.
Since standard SQL functions do not operate on RAW data and PL/SQL does not allow overloading between RAW and CHAR data types, the UTL_RAW package is essential.
UTL_RAW is not limited to use within a database environment, hence the prefix UTL is used instead of DBMS.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
Use UTL_RAW
UTL_RAW allows you to create a RAW "record" composed of multiple elements. By using the RAW data type, character set conversion is not performed, preserving the original format of RAW during remote calls.
UTL_RAW subprograms
The following table lists the UTL_RAW subprograms supported in the current version of OceanBase Database and provides a brief description for each.
| Subprogram | Description |
|---|---|
| BIT_AND | Performs a bitwise logical "AND" on the values in RAW r1 and RAW r2 and returns the original "AND" result. |
| BIT_COMPLEMENT | Performs a bitwise logical "complement" on the value in RAW r and returns the "complement" result as a RAW value. |
| BIT_OR | Performs a bitwise logical "OR" on the values in RAW r1 and RAW r2 and returns the original "OR" result. |
| BIT_XOR | Performs a bitwise logical "XOR" on the values in RAW r1 and RAW r2 and returns the original "XOR" result. |
| CAST_FROM_BINARY_DOUBLE | Returns the BINARY_DOUBLE value in RAW binary format. |
| CAST_FROM_BINARY_FLOAT | Returns the BINARY_FLOAT value in RAW binary format. |
| CAST_FROM_BINARY_INTEGER | Returns the BINARY_INTEGER value in RAW binary format. |
| CAST_FROM_NUMBER | Returns the NUMBER value in RAW binary format. |
| CAST_TO_BINARY_DOUBLE | Converts the BINARY_DOUBLE value represented in RAW binary format to a BINARY_DOUBLE value. |
| CAST_TO_BINARY_FLOAT | Converts the BINARY_FLOAT value represented in RAW binary format to a BINARY_FLOAT value. |
| CAST_TO_BINARY_INTEGER | Converts the BINARY_INTEGER value represented in RAW binary format to a BINARY_INTEGER value. |
| CAST_TO_NUMBER | Converts the NUMBER value represented in RAW binary format to a NUMBER value. |
| CAST_TO_RAW | Converts a VARCHAR2 value to a RAW value. |
| CAST_TO_VARCHAR2 | Converts a RAW value to a VARCHAR2 value. |
| COPIES | Returns the n copies of r concatenated together. |
| COMPARE | Compares RAW r1 and RAW r2. |
| CONCAT | Concatenates up to 12 RAW values into one RAW value. |
| LENGTH | Returns the byte length of RAW r. |
| REVERSE | Reverses the byte sequence in RAW r from end to end. |
| SUBSTR | Returns len bytes starting from the posth byte of RAW r. |
| TRANSLATE | Performs byte-by-byte conversion on RAW data. |