UTL_RAW

Related Interfaces

Table 1 provides all interfaces supported by the UTL_RAW package.

Table 1 UTL_RAW

API

Description

UTL_RAW.CAST_FROM_BINARY_INTEGER

Converts an INTEGER type value to a binary representation (RAW type).

UTL_RAW.CAST_TO_BINARY_INTEGER

Converts a binary representation (RAW type) to an INTEGER type value.

UTL_RAW.LENGTH

Obtains the length of the RAW type object.

UTL_RAW.CAST_TO_RAW

Converts a VARCHAR2 type value to a binary expression (RAW type).

The external representation of the RAW type data is hexadecimal and its internal storage form is binary. For example, the representation of the RAW type data 11001011 is 'CB'. The input of the actual type conversion is 'CB'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
-- Perform operations on RAW data in a stored procedure.
CREATE OR REPLACE PROCEDURE proc_raw
AS
str varchar2(100) := 'abcdef';
source raw(100);
amount integer;
BEGIN
source := utl_raw.cast_to_raw(str);--Convert the type.
amount := utl_raw.length(source);--Obtain the length.
dbms_output.put_line(amount);
END;
/

-- Invoke the stored procedure.
CALL proc_raw();

-- Delete the stored procedure.
DROP PROCEDURE proc_raw;