Updated on 2025-07-15 GMT+08:00

DBE_RAW

APIs

Table 1 provides all APIs supported by the DBE_RAW package.

Table 1 DBE_RAW

API

Description

DBE_RAW.CAST_FROM_BINARY_INTEGER_TO_RAW

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

DBE_RAW.CAST_FROM_RAW_TO_BINARY_INTEGER

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

DBE_RAW.GET_LENGTH

Obtains the length of a RAW object.

DBE_RAW.CAST_FROM_VARCHAR2_TO_RAW

Converts a value of the VARCHAR2 type to a binary representation (RAW type).

DBE_RAW.CAST_TO_VARCHAR2

Converts a value of the RAW type to a value of the VARCHAR2 type.

DBE_RAW.SUBSTR

Returns the substring of the RAW type.

DBE_RAW.BIT_OR

Performs the bitwise OR operation on raw data.

RAW data is represented as hexadecimal characters externally, and stored as binary characters internally. For example, the representation of RAW data 11001011 is 'CB', that is, the input for type conversion is 'CB'.

  • DBE_RAW.CAST_FROM_BINARY_INTEGER_TO_RAW

    The stored procedure CAST_FROM_BINARY_INTEGER_TO_RAW converts a value of the INTEGER type to a binary representation (RAW type).

    The prototype of the DBE_RAW.CAST_FROM_BINARY_INTEGER_TO_RAW function is as follows:

    1
    2
    3
    4
    DBE_RAW.CAST_FROM_BINARY_INTEGER_TO_RAW (
    value          IN  INTEGER,
    endianess      IN  INTEGER DEFAULT 1)
    RETURN RAW;
    
    Table 2 DBE_RAW.CAST_FROM_BINARY_INTEGER_TO_RAW parameters

    Parameter

    Description

    value

    Specifies the INTEGER value to be converted to the RAW value.

    endianess

    Specifies the INTEGER value 1 or 2 for the byte sequence. (1 indicates BIG_ENDIAN and 2 indicates LITTLE-ENDIAN.)

  • DBE_RAW.CAST_FROM_RAW_TO_BINARY_INTEGER

    The stored procedure CAST_FROM_RAW_TO_BINARY_INTEGER converts a binary representation (RAW type) to a value of the INTEGER type.

    The prototype of the DBE_RAW.CAST_FROM_RAW_TO_BINARY_INTEGER function is as follows:

    1
    2
    3
    4
    DBE_RAW.CAST_FROM_RAW_TO_BINARY_INTEGER (
    value          IN  RAW,
    endianess      IN  INTEGER DEFAULT 1)
    RETURN BINARY_INTEGER;
    
    Table 3 DBE_RAW.CAST_FROM_RAW_TO_BINARY_INTEGER parameters

    Parameter

    Description

    value

    Specifies an INTEGER value in a binary representation (RAW type).

    endianess

    Specifies the INTEGER value 1 or 2 for the byte sequence. (1 indicates BIG_ENDIAN and 2 indicates LITTLE-ENDIAN.)

  • DBE_RAW.GET_LENGTH

    The stored procedure GET_LENGTH returns the length of a RAW object.

    The prototype of the DBE_RAW.GET_LENGTH function is as follows:

    1
    2
    3
    DBE_RAW.GET_LENGTH(
    value     IN    RAW)
    RETURN INTEGER;
    
    Table 4 DBE_RAW.GET_LENGTH parameters

    Parameter

    Description

    value

    Specifies a RAW object.

  • DBE_RAW.CAST_FROM_VARCHAR2_TO_RAW

    The stored procedure CAST_FROM_VARCHAR2_TO_RAW converts a VARCHAR2 object to a RAW object.

    The prototype of the DBE_RAW.CAST_FROM_VARCHAR2_TO_RAW function is as follows:

    1
    2
    3
    DBE_RAW.CAST_TO_RAW(
    str     IN    VARCHAR2)
    RETURN RAW;
    
    Table 5 DBE_RAW.CAST_FROM_VARCHAR2_TO_RAW parameters

    Parameter

    Description

    c

    Specifies a VARCHAR2 object to be converted.

  • DBE_RAW.CAST_TO_VARCHAR2

    The stored procedure CAST_TO_VARCHAR2 converts a RAW object to a VARCHAR2 object.

    The prototype of the DBE_RAW.CAST_TO_VARCHAR2 function is as follows:

    1
    2
    3
    DBE_RAW.CAST_TO_VARCHAR2(
    str     IN    RAW)
    RETURN VARCHAR2;
    
    Table 6 DBE_RAW.CAST_TO_VARCHAR2 parameters

    Parameter

    Description

    str

    Specifies a RAW object to be converted.

  • DBE_RAW.BIT_OR

    The stored procedure BIT_OR calculates the bitwise OR result of two raw data records.

    The prototype of the DBE_RAW.BIT_OR function is as follows:

    1
    2
    3
    4
    DBE_RAW.BIT_OR(
    str1     IN    RAW,
    str2     IN    RAW)
    RETURN RAW;
    
    Table 7 DBE_RAW.BIT_OR parameters

    Parameter

    Description

    str1

    First character string of the bitwise OR operation

    str2

    Second character string of the bitwise OR operation

  • DBE_RAW.SUBSTR

    The stored procedure SUBSTR truncates an object of the RAW type based on the start bit and length.

    The prototype of the DBE_RAW.SUBSTR function is as follows:

    1
    2
    3
    4
    5
    DBE_RAW.SUBSTR(
        IN lob_loc raw,
        IN off_set integer default 1,
        IN amount integer default 32767)
    RETURN RAW;
    
    Table 8 DBE_RAW.SUBSTR parameters

    Parameter

    Description

    lob_loc

    Source raw character string

    off_set

    Start position of a substring. The default value is 1.

    amount

    Length of a substring. The default value is 32767.

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 := dbe_raw.cast_from_varchar2_to_raw(str);--Convert the type.
 amount := dbe_raw.get_length(source);-- Obtain the length.
dbe_output.print_line(amount);
END;
/

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

-- Drop the stored procedure.
DROP PROCEDURE proc_raw;