RAWTOHEX

RAWTOHEX is a SQL function that converts raw binary data into a hexadecimal string representation. The output of the function is a string that contains the hexadecimal representation of the bytes contained in the input raw value.

RAWTOHEX(raw_value RAW) RETURN VARCHAR2;

  • raw_value raw: This parameter is the raw binary data that needs to be converted into hexadecimal characters. RAW data type in Oracle is used to store binary data or byte string, and the raw_value is that binary value that is to be transformed into the hexadecimal equivalent.

Example

SELECT RAWTOHEX('123') FROM dual;

Output

'313233'

Explanation

RAWTOHEX is a conversion function in Oracle that is used to convert raw data into hexadecimal format. In this example, each character of the raw input ‘123’ is transformed into its corresponding hexadecimal representation. ‘1’ becomes ‘31’, ‘2’ becomes ‘32’, and ‘3’ becomes ‘33’. The result is the concatenated hexadecimal string ‘313233’.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.