Oracle TO_BLOB(raw) Function
Oracle TO_BLOB(raw) is a built-in function that converts a given LONG RAW and RAW value to a BLOB value.
Within a PL/SQL package, you can use TO_BLOB(raw) to convert RAW and BLOB values to BLOB.
Oracle TO_BLOB(raw) Syntax
Here’s the syntax for the Oracle TO_BLOB(raw) function:
TO_BLOB(raw_value)
Parameters
raw_value-
Required. A
RAWvalue.
Return Value
The Oracle TO_BLOB(raw) function returns a BLOB value converted from the given LONG RAW and RAW values.
If any of the parameters are NULL, TO_BLOB(raw) will return NULL.
Oracle TO_BLOB(raw) Examples
Here are a few examples demonstrating the usage of the Oracle TO_BLOB(raw) function.
Basic Usage
The following example converts a raw value 'A' to a BLOB value:
SELECT TO_BLOB(HEXTORAW('A'))
FROM dual;
输出:
TO_BLOB(HEXTORAW('A'))
_________________________
0ANULL Parameter
If the parameter is NULL, TO_BLOB() will return NULL.
SET NULL 'NULL';
SELECT TO_BLOB(NULL)
FROM dual;
输出:
TO_BLOB(NULL)
________________
NULLIn this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.
Conclusion
Oracle TO_BLOB(raw) is a built-in function that converts a given LONG RAW and RAW value to a BLOB value.