Updated on 2024-06-03 GMT+08:00

PKG_UTIL

Table 1 lists all APIs supported by PKG_UTIL.

Table 1 PKG_UTIL

API

Description

PKG_UTIL.LOB_GET_LENGTH

Obtains the length of a LOB.

PKG_UTIL.LOB_READ

Reads a part of a LOB.

PKG_UTIL.LOB_WRITE

Writes the source object to the target object in the specified format.

PKG_UTIL.LOB_APPEND

Appends the source LOB to the target LOB.

PKG_UTIL.LOB_COMPARE

Compares two LOBs based on the specified length.

PKG_UTIL.LOB_MATCH

Returns the position of the Nth occurrence of a character string in a LOB.

PKG_UTIL.LOB_RESET

Resets the character in specified position of a LOB to a specified character.

PKG_UTIL.LOB_GET_LENGTH

Obtains and returns the specified length of a LOB.

PKG_UTIL.LOB_READ_HUGE

Reads a part of the LOB content based on the specified length and initial position offset, and returns the read LOB and length.

PKG_UTIL.LOB_WRITEAPPEND_HUGE

Reads the content of a specified length from the source BLOB or CLOB, appends the content to the target BLOB or CLOB, and returns the target object.

PKG_UTIL.LOB_APPEND_HUGE

Appends the source BLOB or CLOB to the target BLOB/CLOB and returns the target object.

PKG_UTIL.READ_BFILE_TO_BLOB

Loads the source BFILE file to the target BLOB and returns the target object.

PKG_UTIL.LOB_COPY_HUGE

Reads the content of a specified length from the specified offset position of the source BLOB or CLOB, writes the content to the specified offset position of the target BLOB or CLOB, and returns the target object.

PKG_UTIL.BLOB_RESET

Sets a segment of data in a BLOB to the specified value and returns the processed BLOB and the actually processed length.

PKG_UTIL.CLOB_RESET

Sets a segment of data in a CLOB to spaces and returns the processed CLOB and the actually processed length.

PKG_UTIL.LOADBLOBFROMFILE

Reads the content of a specified length from the specified offset position of the source BFILE object, writes the content to the specified offset position of the target BLOB, and returns the target object, read position, and write position.

PKG_UTIL.LOADCLOBFROMFILE

Reads the content of a specified length from the specified offset position of the source BFILE object, writes the content to the specified offset position of the target CLOB, and returns the target object, read position, and write position.

PKG_UTIL.LOB_CONVERTTOBLOB_HUGE

Reads the content of a specified length from the specified offset position of the source CLOB, converts the content into a BLOB, and writes the BLOB to the specified position of target LOB. amount indicates the length to be converted.

PKG_UTIL.LOB_CONVERTTOCLOB_HUGE

Reads the content of a specified length from the specified offset position of the source CLOB, converts the content into a CLOB, and writes the CLOB to the specified position of target LOB. amount indicates the length to be converted.

PKG_UTIL.BFILE_GET_LENGTH

Obtains and returns the specified length of a BFILE file.

PKG_UTIL.BFILE_OPEN

Opens a BFILE file and returns its file descriptor.

PKG_UTIL.BFILE_CLOSE

Closes a BFILE file.

PKG_UTIL.LOB_WRITE_HUGE

Reads the specified length of the source object from the start position, writes the content to the specified offset position of the target LOB, overrides the original content, and returns the target LOB.

PKG_UTIL.IO_PRINT

Displays character strings.

PKG_UTIL.RAW_GET_LENGTH

Obtains the length of RAW data.

PKG_UTIL.RAW_CAST_FROM_VARCHAR2

Converts VARCHAR2 data to RAW data.

PKG_UTIL.RAW_CAST_FROM_....

Converts binary integers to RAW data.

PKG_UTIL.RAW_CAST_TO_BI....

Converts RAW data to binary integers.

PKG_UTIL.RANDOM_SET_SEED

Sets a random seed.

PKG_UTIL.RANDOM_GET_VALUE

Returns a random value.

PKG_UTIL.FILE_SET_DIRNAME

Sets the directory to be operated.

PKG_UTIL.FILE_OPEN

Opens a file based on the specified file name and directory.

PKG_UTIL.FILE_SET_MAX_LINE_SIZE

Sets the maximum length of a line to be written to a file.

PKG_UTIL.FILE_IS_CLOSE

Checks whether a file handle is closed.

PKG_UTIL.FILE_READ

Reads data of a specified length from an open file handle.

PKG_UTIL.FILE_READLINE

Reads a line of data from an open file handle.

PKG_UTIL.FILE_WRITE

Writes the data specified in the buffer to a file.

PKG_UTIL.FILE_WRITELINE

Writes the buffer to a file and adds newline characters.

PKG_UTIL.FILE_NEWLINE

Adds a line.

PKG_UTIL.FILE_READ_RAW

Reads binary data of a specified length from an open file handle.

PKG_UTIL.FILE_WRITE_RAW

Writes binary data to a file.

PKG_UTIL.FILE_FLUSH

Writes data from a file handle to a physical file.

PKG_UTIL.FILE_CLOSE

Closes an open file handle.

PKG_UTIL.FILE_REMOVE

Deletes a physical file. To do so, you must have the corresponding permission.

PKG_UTIL.FILE_RENAME

Renames files on the disk, similar to mv in Unix.

PKG_UTIL.FILE_SIZE

Returns the size of a file.

PKG_UTIL.FILE_BLOCK_SIZE

Returns the number of blocks contained in a file.

PKG_UTIL.FILE_EXISTS

Checks whether a file exists.

PKG_UTIL.FILE_GETPOS

Specifies the offset of a returned file, in bytes.

PKG_UTIL.FILE_SEEK

Sets the offset for file position.

PKG_UTIL.FILE_CLOSE_ALL

Closes all file handles opened in a session.

PKG_UTIL.EXCEPTION_REPORT_ERROR

Throws an exception.

PKG_UTIL.LOB_RAWTOTEXT

Converts the RAW type to the TEXT type.

PKG_UTIL.UTILITY_COMPILE_SCHEMA

Recompiles specified schemas, functions, and stored procedures. If an error is reported when compiling a PL/SQL object, the PL/SQL object is returned and the recompilation stops. This package has been discarded. pkg_util.gs_compile_schema is recommended.

PKG_UTIL.GS_COMPILE_SCHEMA

Recompiles specified schemas, functions, and stored procedures. If an error is reported when compiling a PL/SQL object, the exception is captured and the recompilation continues to compile other objects until all objects are compiled or the number of recompilation attempts reaches the upper limit. When the advanced package is executed through JDBC, the SQLSTATE 00000 is displayed, which indicates that the operation is successful. For details about the error code description, see "Standard SQL Error Codes" in Error Code Reference.

PKG_UTIL.APP_SET_MODULE

Sets the value of a module.

PKG_UTIL.APP_READ_MODULE

Reads the value of a module.

PKG_UTIL.APP_SET_ACTION

Sets the value of an action.

PKG_UTIL.APP_READ_ACTION

Reads the value of an action.

PKG_UTIL.MODIFY_PACKAGE_STATE

Modifies the PL/SQL status of the current session.

  • PKG_UTIL.LOB_GET_LENGTH

    Obtains the length of the input data.

    The prototype of the PKG_UTIL.LOB_GET_LENGTH function is as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    PKG_UTIL.LOB_GET_LENGTH(
    lob       IN   CLOB
    )
    RETURN INTEGER;
    
    PKG_UTIL.LOB_GET_LENGTH(
    lob       IN   BLOB
    )
    RETURN INTEGER;
    
    Table 2 PKG_UTIL.LOB_GET_LENGTH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    CLOB/BLOB

    IN

    No

    Indicates the object whose length is to be obtained.

  • PKG_UTIL.LOB_READ

    Reads an object and returns the specified part.

    The prototype of the PKG_UTIL.LOB_READ function is as follows:
    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_READ(
    lob       IN   ANYELEMENT,
    len       IN   INT,
    start     IN   INT,
    mode      IN   INT
    )
    RETURN ANYELEMENT
    
    Table 3 PKG_UTIL.LOB_READ parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    CLOB/BLOB

    IN

    No

    Specifies CLOB or BLOB data.

    len

    INT

    IN

    No

    Specifies the length of the returned result.

    start

    INT

    IN

    No

    Specifies the offset to the first character.

    mode

    INT

    IN

    No

    Specifies the type of the read operation. 0 indicates READ, 1 indicates TRIM, and 2 indicates SUBSTR.

  • PKG_UTIL.LOB_WRITE

    Writes the source object to the target object based on the specified parameters and returns the target object.

    The prototype of the PKG_UTIL.LOB_WRITE function is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    PKG_UTIL.LOB_WRITE(
    dest_lob    INOUT   BLOB,
    src_lob     IN      RAW
    len         IN      INT,
    start_pos   IN      BIGINT
    )
    RETURN BLOB;
    PKG_UTIL.LOB_WRITE(
    dest_lob    INOUT   CLOB,
    src_lob     IN      VARCHAR2
    len         IN      INT,
    start_pos   IN      BIGINT
    )
    RETURN CLOB;
    
    Table 4 PKG_UTIL.LOB_WRITE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    CLOB/BLOB

    INOUT

    No

    Specifies the target object that data will be written to.

    src_lob

    CLOB/BLOB

    IN

    No

    Specifies the source object to be written.

    len

    INT

    IN

    No

    Specifies the write length of the source object.

    start_pos

    BIGINT

    IN

    No

    Specifies the write start position of the target object.

  • PKG_UTIL.LOB_APPEND

    Appends the source object to the target BLOB/CLOB and returns the target BLOB/CLOB.

    The prototype of the PKG_UTIL.LOB_APPEND function is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    PKG_UTIL.LOB_APPEND(
    dest_lob    INOUT   BLOB,
    src_lob     IN      BLOB,
    len         IN      INT DEFAULT NULL
    )
    RETURN BLOB;
    
    PKG_UTIL.LOB_APPEND(
    dest_lob    INOUT   CLOB,
    src_lob     IN      CLOB,
    len         IN      INT DEFAULT NULL
    )
    RETURN CLOB;
    
    Table 5 PKG_UTIL.LOB_APPEND parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB/CLOB

    INOUT

    No

    Target BLOB/CLOB to which data is written.

    src_lob

    BLOB/CLOB

    IN

    No

    BLOB/CLOB from which data is to be written.

    len

    INT

    IN

    Yes

    Length read from src and appended to dest. The default value is NULL, indicating that all content of src is read and appended to dest.

  • PKG_UTIL.LOB_COMPARE

    Checks whether objects are the same based on the specified start position and size. If lob1 is larger, 1 is returned. If lob2 is larger, –1 is returned. If lob1 is equal to lob2, 0 is returned.

    The prototype of the PKG_UTIL.LOB_COMPARE function is as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    PKG_UTIL.LOB_COMPARE(
    lob1        IN   ANYELEMENT,
    lob2        IN   ANYELEMENT,
    len         IN   INT DEFAULT 1073741771,
    start_pos1      IN   INT DEFAULT 1,
    start_pos2      IN   INT DEFAULT 1
    )
    RETURN INTEGER;
    
    Table 6 PKG_UTIL.LOB_COMPARE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob1

    CLOB/BLOB

    IN

    No

    Indicates the character string for comparison.

    lob2

    CLOB/BLOB

    IN

    No

    Indicates the character string for comparison.

    len

    INT

    IN

    No

    Indicates the length to be compared.

    start_pos1

    INT

    IN

    No

    Specifies the start offset of lob1.

    start_pos2

    INT

    IN

    No

    Specifies the start offset of lob2.

  • PKG_UTIL.LOB_MATCH

    Returns the position where a pattern is displayed in a LOB for the match_nth time.

    The prototype of the PKG_UTIL.LOB_MATCH function is as follows:
    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_MATCH(
    lob          IN   ANYELEMENT,
    pattern      IN   ANYELEMENT,
    start        IN   INT,
    match_nth    IN   INT DEFAULT 1
    )
    RETURN INTEGER;
    
    Table 7 PKG_UTIL.LOB_MATCH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    CLOB/BLOB

    IN

    No

    Indicates the character string for comparison.

    pattern

    CLOB/BLOB

    IN

    No

    Specifies the pattern to be matched.

    start

    INT

    IN

    No

    Specifies the start position for LOB comparison.

    match_nth

    INT

    IN

    No

    Specifies the matching times.

  • PKG_UTIL.LOB_RESET

    Clears a character string and resets the string to the value of value.

    The prototype of the PKG_UTIL.LOB_RESET function is as follows:
    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_RESET(
    lob          IN   BLOB,
    len          IN   INT,
    start        IN   INT,
    value        IN   INT DEFAULT 0
    )
    RETURN RECORD;
    
    Table 8 PKG_UTIL.LOB_RESET parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    BLOB

    IN

    No

    Specifies the character string for reset.

    len

    INT

    IN

    No

    Specifies the length of the string to be reset.

    start

    INT

    IN

    No

    Specifies the start position for reset.

    value

    INT

    IN

    Yes

    Sets characters. Default value: '0'

  • PKG_UTIL.LOB_GET_LENGTH

    Obtains and returns the specified length of a LOB.

    The prototype of the PKG_UTIL.LOB_GET_LENGTH function is as follows:

    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_GET_LENGTH(
        lob IN BLOB)
    RETURN BIGINT;
    
    PKG_UTIL.LOB_GET_LENGTH(
        lob IN CLOB)
    RETURN BIGINT;
    
    Table 9 PKG_UTIL.LOB_GET_LENGTH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    BLOB/CLOB

    IN

    No

    LOB type.

  • PKG_UTIL.LOB_READ_HUGE

    Reads a part of the LOB content based on the specified length and initial position offset, and returns the read LOB and length.

    The prototype of the PKG_UTIL.LOB_READ_HUGE function is as follows:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    PKG_UTIL.LOB_READ_HUGE(
        lob       IN CLOB,
        len       IN BIGINT,
        start_pos IN BIGINT,
        mode      IN INTEGER)
    RETURN RECORD;
    
    PKG_UTIL.LOB_READ_HUGE(
        lob       IN BLOB,
        len       IN BIGINT,
        start_pos IN BIGINT,
        mode      IN INTEGER)
    RETURN RECORD;
    
    PKG_UTIL.LOB_READ_HUGE(
        fd        IN INTEGER,
        len       IN BIGINT,
        start_pos IN BIGINT,
        mode      IN INTEGER)
    RETURN RECORD;
    
    Table 10 PKG_UTIL.LOB_READ_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob/fd

    BLOB/CLOB/INTEGER

    IN

    No

    File descriptor of the specified LOB or BFILE file.

    len

    BIGINT

    IN

    No

    Length to read.

    start_pos

    BIGINT

    IN

    No

    Offset position from which read starts.

    mode

    INTEGER

    IN

    No

    Read mode (0: read, 1: trim, 2: substr).

  • PKG_UTIL.LOB_WRITEAPPEND_HUGE

    Reads the content of a specified length from the source BLOB or CLOB, appends the content to the target BLOB or CLOB, and returns the target object.

    The prototype of the PKG_UTIL.LOB_WRITEAPPEND_HUGE function is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    PKG_UTIL.LOB_WRITEAPPEND_HUGE(
        dest_lob INOUT CLOB,
        len      IN    INTEGER,
        src_lob  IN    VARCHAR2
    )RETURN CLOB;
    
    PKG_UTIL.LOB_WRITEAPPEND_HUGE(
        dest_lob INOUT BLOB,
        len      IN    INTEGER,
        src_lob  IN    RAW
    )RETURN BLOB;
    
    Table 11 PKG_UTIL.LOB_WRITEAPPEND_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB/CLOB

    INOUT

    No

    Target BLOB/CLOB to which data is written.

    len

    INTEGER

    IN

    Yes

    Length of the source object to be written. If the value is NULL, the entire source object is written by default.

    src_lob

    VARCHAR2/RAW

    IN

    No

    BLOB/CLOB from which data is to be written.

  • PKG_UTIL.LOB_APPEND_HUGE

    Appends the source BLOB or CLOB to the target BLOB/CLOB and returns the target object.

    The prototype of the PKG_UTIL.LOB_APPEND_HUGE function is as follows:
    1
    2
    3
    4
    PKG_UTIL.LOB_APPEND_HUGE(
        dest_lob INOUT BLOB,
        src_lob  IN    BLOB)
    RETURN BLOB;
    
    1
    2
    3
    4
    PKG_UTIL.LOB_APPEND_HUGE(
        dest_lob INOUT CLOB,
        src_lob  IN    CLOB)
    RETURN CLOB;
    
    Table 12 PKG_UTIL.LOB_APPEND_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB/CLOB

    INOUT

    No

    Target BLOB/CLOB to which data is written.

    src_lob

    BLOB/CLOB

    IN

    No

    BLOB/CLOB from which data is to be written.

  • PKG_UTIL.READ_BFILE_TO_BLOB

    Loads the source BFILE file to the target BLOB and returns the target object.

    The prototype of the PKG_UTIL.READ_BFILE_TO_BLOB function is as follows:
    1
    2
    3
    PKG_UTIL.READ_BFILE_TO_BLOB(
        fd IN INTEGER
    )RETURN BLOB;
    
    Table 13 PKG_UTIL.READ_BFILE_TO_BLOB parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    fd

    INTEGER

    IN

    No

    Source BFILE file to be read.

  • PKG_UTIL.LOB_COPY_HUGE

    Reads the content of a specified length from the specified offset position of the source BLOB or CLOB, writes the content to the specified offset position of the target BLOB or CLOB, and returns the target object.

    The prototype of the PKG_UTIL.LOB_COPY_HUGE function is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    PKG_UTIL.LOB_COPY_HUGE(
        lob_obj    INOUT BLOB,
        source_obj  IN    BLOB,
        amount      IN    BIGINT, 
        dest_offset IN    BIGINT DEFAULT 1, 
        src_offset  IN    BIGINT DEFAULT 1 
    )RETURN BLOB;
    
    PKG_UTIL.LOB_COPY_HUGE(
        lob_obj    INOUT CLOB,
        source_obj  IN    CLOB,
        amount      IN    BIGINT, 
        dest_offset IN    BIGINT DEFAULT 1, 
        src_offset  IN    BIGINT DEFAULT 1 
    )RETURN CLOB;
    
    Table 14 PKG_UTIL.LOB_COPY_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob_obj

    BLOB/CLOB

    INOUT

    No

    Target BLOB/CLOB.

    source_obj

    BLOB/CLOB

    IN

    No

    Source BLOB/CLOB.

    amount

    BIGINT

    IN

    No

    Length of the data to be copied (in bytes for BLOBs or in characters for CLOBs).

    dest_offset

    BIGINT

    IN

    No

    Offset position of the target LOB to which the data is loaded.

    src_offset

    BIGINT

    IN

    No

    Offset position of the source LOB from which the data is read.

  • PKG_UTIL.BLOB_RESET

    Sets a segment of data in a BLOB to the specified value and returns the processed BLOB and the actually processed length.

    The prototype of the PKG_UTIL.BLOB_RESET function is as follows:
    1
    2
    3
    4
    5
    6
    PKG_UTIL.BLOB_RESET(
        lob       INOUT BLOB,
        len       INOUT BIGINT,
        start_pos IN    BIGINT DEFAULT 1,
        value     IN    INTEGER DEFAULT 0
    )RETURN RECORD;
    
    Table 15 PKG_UTIL.BLOB_RESET parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    BLOB

    INOUT

    No

    LOB to be reset.

    len

    INTEGER

    INOUT

    No

    Length to reset, in bytes.

    start

    INTEGER

    IN

    No

    Specifies the start position for reset.

    value

    INTEGER

    IN

    Yes

    Sets characters. Default value: '0'.

  • PKG_UTIL.CLOB_RESET

    Sets a piece of data to spaces.

    The prototype of the PKG_UTIL.CLOB_RESET function is as follows:
    1
    2
    3
    4
    5
    PKG_UTIL.CLOB_RESET(
        lob       INOUT CLOB,
        len       INOUT BIGINT,
        start_pos IN    BIGINT DEFAULT 1
    )RETURN RECORD;
    
    Table 16 PKG_UTIL.CLOB_RESET parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    lob

    CLOB

    INOUT

    No

    LOB to be reset.

    len

    INTEGER

    INOUT

    No

    Length to reset, in characters.

    start

    INTEGER

    IN

    No

    Reset start position. The default value is 1.

  • PKG_UTIL.LOADBLOBFROMFILE

    Reads the content of a specified length from the specified offset position of the source BFILE object, writes the content to the specified offset position of the target BLOB, and returns the target object, read position, and write position.

    The prototype of the PKG_UTIL.LOADBLOBFROMFILE function is as follows:
    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOADBLOBFROMFILE(
        dest_lob     INOUT  BLOB,
        fd           IN     INTEGER,
        amount       IN     BIGINT,
        dest_offset  INOUT  BIGINT,
        file_offset  INOUT  BIGINT
    )RETURN RECORD;
    
    Table 17 PKG_UTIL.LOADBLOBFROMFILE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB

    INOUT

    No

    Target BLOB as the INOUT parameter.

    fd

    INTEGER

    IN

    No

    File descriptor of the source BFILE object.

    amount

    BIGINT

    IN

    No

    Length of the data to be copied (in bytes for BLOBs or in characters for CLOBs).

    dest_offset

    BIGINT

    INOUT

    No

    Offset position of the target LOB to which the data is written as the INOUT parameter.

    src_offset

    BIGINT

    INOUT

    No

    Offset position of the source BFILE file from which the data is read as the INOUT parameter.

  • PKG_UTIL.LOADCLOBFROMFILE

    Reads the content of a specified length from the specified offset position of the source BFILE object, writes the content to the specified offset position of the target CLOB, and returns the target object, read position, and write position.

    The prototype of the PKG_UTIL.LOADCLOBFROMFILE function is as follows:
    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOADCLOBFROMFILE(
        dest_lob     INOUT  CLOB,
        fd           IN     INTEGER,
        amount       IN     BIGINT,
        dest_offset  INOUT  BIGINT,
        file_offset  INOUT  BIGINT
    )RETURN RECORD;
    
    Table 18 PKG_UTIL.LOADCLOBFROMFILE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    CLOB

    INOUT

    No

    Target CLOB as the INOUT parameter.

    fd

    INTEGER

    IN

    No

    File descriptor of the source BFILE object.

    amount

    BIGINT

    IN

    No

    Length to copy (in characters for CLOBs).

    dest_offset

    BIGINT

    INOUT

    No

    Offset position of the target LOB to which the data is written as the INOUT parameter.

    src_offset

    BIGINT

    INOUT

    No

    Offset position of the source BFILE file from which the data is read as the INOUT parameter.

  • PKG_UTIL.LOB_CONVERTTOBLOB_HUGE

    Reads the content of a specified length from the specified offset position of the source CLOB, converts the content into a BLOB, and writes the BLOB to the specified position of target LOB. amount indicates the length to be converted.

    The prototype of the PKG_UTIL.LOB_CONVERTTOBLOB_HUGE function is as follows:

    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_CONVERTTOBLOB_HUGE(
        dest_lob    INOUT  BLOB,
        src_clob    IN     CLOB,
        amount      IN     BIGINT,
        dest_offset INOUT  BIGINT,
        src_offset  INOUT  BIGINT)
    )RETURN RECORD;
    
    Table 19 PKG_UTIL.LOB_CONVERTTOBLOB_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB

    INOUT

    No

    Target LOB.

    src_clob

    CLOB

    IN

    No

    CLOB to be converted.

    amount

    BIGINT

    IN

    No

    Length to convert, in characters.

    dest_offset

    BIGINT

    INOUT

    No

    Offset position of the target LOB to which the data is written as the INOUT parameter.

    src_offset

    BIGINT

    INOUT

    No

    Offset position of the source CLOB from which the data is read as the INOUT parameter.

  • PKG_UTIL.LOB_CONVERTTOCLOB_HUGE

    Reads the content of a specified length from the specified offset position of the source CLOB, converts the content into a CLOB, and writes the CLOB to the specified position of target LOB. amount indicates the length to be converted.

    The prototype of the PKG_UTIL.LOB_CONVERTTOCLOB_HUGE function is as follows:

    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_CONVERTTOCLOB_HUGE(
        dest_lob    INOUT  CLOB,
        src_blob    IN     BLOB,
        amount      IN     BIGINT,
        dest_offset INOUT  BIGINT,
        src_offset  INOUT  BIGINT)
    )RETURN RECORD;
    
    Table 20 PKG_UTIL.LOB_CONVERTTOCLOB_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    CLOB

    INOUT

    No

    Target LOB.

    src_blob

    BLOB

    IN

    No

    BLOB to be converted.

    amount

    BIGINT

    IN

    No

    Length to convert, in bytes.

    dest_offset

    BIGINT

    INOUT

    No

    Offset position of the target LOB to which the data is written as the INOUT parameter.

    src_offset

    BIGINT

    INOUT

    No

    Offset position of the source CLOB from which the data is read as the INOUT parameter.

  • PKG_UTIL.BFILE_GET_LENGTH

    Obtains and returns the specified length of a BFILE file.

    The prototype of the PKG_UTIL.BFILE_GET_LENGTH function is as follows:

    1
    2
    3
    PKG_UTIL.BFILE_GET_LENGTH(
        fd INTEGER
    )RETURN BIGINT;
    
    Table 21 PKG_UTIL.LOB_GET_LENGTH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    fd

    INTEGER

    IN

    No

    File descriptor of the specified BFILE file.

  • PKG_UTIL.BFILE_OPEN

    Opens a BFILE file and returns its file descriptor.

    The prototype of the PKG_UTIL.BFILE_OPEN function is as follows:

    1
    2
    3
    4
    PKG_UTIL.BFILE_OPEN(
        file_name TEXT,
        open_mode TEXT)
    RETURN INTEGER;
    
    Table 22 PKG_UTIL.BFILE_OPEN parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file_name

    TEXT

    IN

    No

    Name of the specified BFILE file.

    open_mode

    TEXT

    IN

    No

    Open mode, which can only be set to r, that is, the read mode.

  • PKG_UTIL.BFILE_CLOSE

    Closes a BFILE file.

    The prototype of the PKG_UTIL.BFILE_CLOSE function is as follows:

    1
    2
    3
    PKG_UTIL.BFILE_CLOSE(
        fd INTEGER)
    RETURN BOOL;
    
    Table 23 PKG_UTIL.BFILE_CLOSE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    fd

    INTEGER

    IN

    No

    File descriptor of the specified BFILE file.

  • PKG_UTIL.LOB_WRITE_HUGE

    Reads the specified length of the source object from the start position, writes the content to the specified offset position of the target LOB, overrides the original content, and returns the target LOB.

    The prototype of the PKG_UTIL.LOB_WRITE_HUGE function is as follows:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    PKG_UTIL.LOB_WRITE_HUGE(
        dest_lob  INOUT BLOB,
        len       IN INTEGER,
        start_pos IN BIGINT,
        src_lob   IN RAW
    )RETURN BLOB;
    
    PKG_UTIL.LOB_WRITE_HUGE(
        dest_lob  INOUT CLOB,
        len       IN INTEGER,
        start_pos IN BIGINT,
        src_lob   IN VARCHAR2
    )RETURN CLOB;
    
    Table 24 PKG_UTIL.LOB_WRITE_HUGE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB/CLOB

    INOUT

    No

    Target LOB as the INOUT parameter, to which the content is to be written.

    len

    INTEGER

    IN

    No

    Length of the data to be written (in bytes for BLOBs or in characters for CLOBs).

    start_pos

    bigint

    IN

    No

    Offset position for writing data to dest_lob.

    src_lob

    RAW/VARCHAR2

    IN

    No

    Source LOB.

  • PKG_UTIL.IO_PRINT

    Outputs a string.

    The prototype of the PKG_UTIL.IO_PRINT function is as follows:
    1
    2
    3
    4
    5
    PKG_UTIL.IO_PRINT(
    format       IN   TEXT,
    is_one_line  IN   BOOLEAN
    )
    RETURN VOID;
    
    Table 25 PKG_UTIL.IO_PRINT parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    format

    TEXT

    IN

    No

    Specifies the character string to be output.

    is_one_line

    BOOLEAN

    IN

    No

    Specifies whether to output the string as a line.

  • PKG_UTIL.RAW_GET_LENGTH

    Obtains the length of RAW data.

    The prototype of the PKG_UTIL.RAW_GET_LENGTH function is as follows:
    1
    2
    3
    4
    PKG_UTIL.RAW_GET_LENGTH(
    value       IN   RAW
    )
    RETURN INTEGER;
    
    Table 26 PKG_UTIL.RAW_GET_LENGTH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    raw

    RAW

    IN

    No

    Specifies the object whose length is to be obtained.

  • PKG_UTIL.RAW_CAST_FROM_VARCHAR2

    Converts VARCHAR2 data to RAW data.

    The prototype of the PKG_UTIL.RAW_CAST_FROM_VARCHAR2 function is as follows:
    1
    2
    3
    4
    PKG_UTIL.RAW_CAST_FROM_VARCHAR2(
    str       IN   VARCHAR2
    )
    RETURN RAW;
    
    Table 27 PKG_UTIL.RAW_CAST_FROM_VARCHAR2 parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    str

    VARCHAR2

    IN

    No

    Specifies the source data to be converted.

  • PKG_UTIL.RAW_CAST_FROM_BINARY_INTEGER

    Converts BIGINT data to RAW data.

    The prototype of the PKG_UTIL.RAW_CAST_FROM_BINARY_INTEGER function is as follows:
    1
    2
    3
    4
    5
    PKG_UTIL.RAW_CAST_FROM_BINARY_INTEGER(
    value       IN   BIGINT,
    endianess   IN   INTEGER
    )
    RETURN RAW;
    
    Table 28 PKG_UTIL.RAW_CAST_FROM_BINARY_INTEGER parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    value

    BIGINT

    IN

    No

    Specifies the source data to be converted.

    endianess

    INTEGER

    IN

    No

    The value is an integer in lexicographic order. Currently, the value can be 1 (BIG_ENDIAN), 2 (LITTLE_ENDIAN), or 3 (MACHINE_ENDIAN).

  • PKG_UTIL.RAW_CAST_TO_BINARY_INTEGER

    Converts RAW data into BINARY_INTEGER.

    The prototype of the PKG_UTIL.RAW_CAST_TO_BINARY_INTEGER function is as follows:
    1
    2
    3
    4
    5
    PKG_UTIL.RAW_CAST_TO_BINARY_INTEGER(
    value       IN   RAW,
    endianess   IN   INTEGER
    )
    RETURN INTEGER;
    
    Table 29 PKG_UTIL.RAW_CAST_TO_BINARY_INTEGER parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    value

    RAW

    IN

    No

    Specifies the source data to be converted.

    endianess

    INTEGER

    IN

    No

    The value is an integer in lexicographic order. Currently, the value can be 1 (BIG_ENDIAN), 2 (LITTLE_ENDIAN), or 3 (MACHINE_ENDIAN).

  • PKG_UTIL.RANDOM_SET_SEED

    Sets a random seed.

    The prototype of the PKG_UTIL.RANDOM_SET_SEED function is as follows:
    1
    2
    3
    4
    PKG_UTIL.RANDOM_SET_SEED(
    seed         IN   INT
    )
    RETURN INTEGER;
    
    Table 30 PKG_UTIL.RANDOM_SET_SEED parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    seed

    INT

    IN

    No

    Sets a random seed.

  • PKG_UTIL.RANDOM_GET_VALUE

    Returns a 15-digit random number ranging from 0 to 1.

    The prototype of the PKG_UTIL.RANDOM_GET_VALUE function is as follows:
    1
    2
    3
    PKG_UTIL.RANDOM_GET_VALUE(
    )
    RETURN NUMERIC;
    
  • PKG_UTIL.FILE_SET_DIRNAME

    Sets the directory to be operated. It must be called to set directory for each operation involving a single directory.

    The prototype of the PKG_UTIL.FILE_SET_DIRNAME function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_SET_DIRNAME(
    dir  IN  TEXT
    )
    RETURN BOOL
    
    Table 31 PKG_UTIL.FILE_SET_DIRNAME parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dir

    TEXT

    IN

    No

    Directory of a file. It is a string, indicating an object name.

    NOTE:

    File directories need to be added to the system catalog PG_DIRECTORY. If the input path does not match the path in PG_DIRECTORY, an error indicating that the path does not exist will be reported. Functions that involve location as parameters also comply with this rule.

  • PKG_UTIL.FILE_OPEN

    Opens a file. A maximum of 50 files can be opened at a time. This function returns a handle of the INTEGER type.

    The prototype of the PKG_UTIL.FILE_OPEN function is as follows:

    1
    2
    3
    PKG_UTIL.FILE_OPEN(
    file_name    IN  TEXT, 
    open_mode    IN  INTEGER)
    
    Table 32 PKG_UTIL.FILE_OPEN parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file_name

    TEXT

    IN

    No

    File name with an extension (file type), excluding the path name. A path contained in a file name is ignored in the OPEN function. In Unix, the file name cannot end with the combination of a slash and a dot (/.).

    open_mode

    INTEGER

    IN

    No

    File opening mode, including r (read), w (write), and a (append).

    NOTE:

    For the write operation, the system checks the file type. If the ELF file is written, an error is reported and the system exits.

  • PKG_UTIL.FILE_SET_MAX_LINE_SIZE

    Sets the maximum length of a line to be written to a file.

    The prototype of the PKG_UTIL.FILE_SET_MAX_LINE_SIZE function is as follows:

    1
    2
    3
    PKG_UTIL.FILE_SET_MAX_LINE_SIZE(
    max_line_size IN INTEGER)
    RETURN BOOL
    
    Table 33 PKG_UTIL.FILE_SET_MAX_LINE_SIZE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    max_line_size

    INTEGER

    IN

    Yes

    Maximum number of characters in each line, including newline characters. The minimum value is 1 and the maximum is 32767. If this parameter is not specified, the default value 1024 is used.

  • PKG_UTIL.FILE_IS_CLOSE

    Checks whether a file handle is closed.

    The prototype of the PKG_UTIL.FILE_IS_CLOSE function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_IS_CLOSE(
    file IN INTEGER
    )
    RETURN BOOL
    
    Table 34 PKG_UTIL.FILE_IS_CLOSE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

  • PKG_UTIL.FILE_READ

    Reads a line of data from an open file handle based on the specified length.

    The prototype of the PKG_UTIL.FILE_READ function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_READ(
    file     IN   INTEGER,
    buffer   OUT  TEXT,
    len      IN   BIGINT DEFAULT 1024)
    
    Table 35 PKG_UTIL.FILE_READ parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    File handle opened by calling the OPEN function. The file must be opened in read mode. Otherwise, the INVALID_OPERATION exception is thrown.

    buffer

    TEXT

    OUT

    No

    Buffer used to receive data.

    len

    BIGINT

    IN

    No

    Number of bytes read from a file.

  • PKG_UTIL.FILE_READLINE

    Reads a line of data from an open file handle based on the specified length.

    The prototype of the PKG_UTIL.FILE_READLINE function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_READLINE(
    file    IN  INTEGER,
    buffer  OUT TEXT,
    len     IN  INTEGER DEFAULT NULL)
    
    Table 36 PKG_UTIL.FILE_READLINE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    File handle opened by calling the OPEN function. The file must be opened in read mode. Otherwise, the INVALID_OPERATION exception is thrown.

    buffer

    TEXT

    OUT

    No

    Buffer used to receive data.

    len

    INTEGER

    IN

    Yes

    Number of bytes read from a file. The default value is NULL. If the default value NULL is used, max_line_size is used to specify the line size.

  • PKG_UTIL.FILE_WRITE

    Writes the data specified in the buffer to a file.

    The prototype of the PKG_UTIL.FILE_WRITE function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.FILE_WRITE(
    file IN INTEGER,
    buffer IN TEXT
    )
    RETURN BOOL
    
    Table 37 PKG_UTIL.FILE_WRITE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

    buffer

    TEXT

    IN

    No

    Text data to be written to a file. The maximum buffer size is 32767 bytes. If no value is specified, the default value is 1024 bytes. Before the writing is performed, the buffer occupied by PUT operations cannot exceed 32767 bytes.

    NOTE:

    For the write operation, the system checks the file type. If the ELF file is written, an error is reported and the system exits.

  • PKG_UTIL.FILE_NEWLINE

    Writes a line terminator to an open file. The line terminator is related to the platform.

    The prototype of the PKG_UTIL.FILE_NEWLINE function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_NEWLINE(
    file IN INTEGER
    )
    RETURN BOOL
    
    Table 38 PKG_UTIL.FILE_NEWLINE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

  • PKG_UTIL.FILE_WRITELINE

    Writes a line to a file.

    The prototype of the PKG_UTIL.FILE_WRITELINE function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.FILE_WRITELINE(
    file IN INTEGER,
    buffer IN TEXT
    )
    RETURN BOOL
    
    Table 39 PKG_UTIL.FILE_WRITELINE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

    buffer

    TEXT

    IN

    No

    Content to be written.

  • PKG_UTIL.FILE_READ_RAW

    This function reads binary data of a specified length from an open file handle and returns the read binary data. The return type is raw.

    The prototype of the PKG_UTIL.FILE_READ_RAW function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.FILE_READ_RAW(
    file      IN INTEGER,
    length    IN INTEGER DEFAULT NULL
    )
    RETURN RAW
    
    Table 40 PKG_UTIL.FILE_READ_RAW parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

    length

    INTEGER

    IN

    Yes

    Length of the data to be read. The default value is NULL. By default, all data in the file is read. The maximum size is 1 GB.

  • PKG_UTIL.FILE_WRITE_RAW

    Writes the input binary object of the RAW type to an open file. If the insertion is successful, true is returned.

    The prototype of the PKG_UTIL.FILE_WRITE_RAW function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.FILE_WRITE_RAW(
    file IN INTEGER,
    r    IN RAW
    )
    RETURN BOOL
    
    Table 41 PKG_UTIL.FILE_WRITE_RAW parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

    r

    RAW

    IN

    No

    Data to be written to the file.

    NOTE:

    For the write operation, the system checks the file type. If the ELF file is written, an error is reported and the system exits.

  • PKG_UTIL.FILE_FLUSH

    Data in a file handle must be written into a physical file. Data in the buffer must have a line terminator. Refresh is important if a file must be read when it is opened. For example, debugging information can be refreshed to a file so that it can be read immediately.

    The prototype of the PKG_UTIL.FILE_FLUSH function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_FLUSH (
    file IN INTEGER
    )
    RETURN VOID
    
    Table 42 PKG_UTIL.FILE_FLUSH parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

  • PKG_UTIL.FILE_CLOSE

    Closes an open file handle.

    The prototype of the PKG_UTIL.FILE_CLOSE function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_CLOSE (
    file IN INTEGER
    )
    RETURN BOOL
    
    Table 43 PKG_UTIL.FILE_CLOSE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

  • PKG_UTIL.FILE_REMOVE

    Deletes a disk file. To perform this operation, you must have required permissions.

    The prototype of the PKG_UTIL.FILE_REMOVE function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_REMOVE(
    file_name IN TEXT
    )
    RETURN VOID 
    
    Table 44 PKG_UTIL.FILE_REMOVE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    filen_ame

    TEXT

    IN

    No

    Name of the file to be deleted

  • PKG_UTIL.FILE_RENAME

    Renames a file on the disk, similar to mv in Unix.

    The prototype of the PKG_UTIL.FILE_RENAME function is as follows:

    1
    2
    3
    4
    5
    6
    PKG_UTIL.FILE_RENAME(
    src_dir IN TEXT, 
    src_file_name IN TEXT, 
    dest_dir IN TEXT, 
    dest_file_name IN TEXT, 
    overwrite BOOLEAN DEFAULT false)
    
    Table 45 PKG_UTIL.FILE_RENAME parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    src_dir

    TEXT

    IN

    No

    Source file directory (case-sensitive)

    NOTE:
    • Location of the file directory, which needs to be added to system catalog PG_DIRECTORY. If the input path does not match the path in PG_DIRECTORY, an error indicating that the path does not exist is reported.
    • When the GUC parameter safe_data_path is enabled, you can only use an advanced package to operate files in the file path specified by safe_data_path.

    src_file_name

    TEXT

    IN

    No

    Source file name

    dest_dir

    TEXT

    IN

    No

    Target file directory (case-sensitive)

    NOTE:
    • Location of the file directory, which needs to be added to system catalog PG_DIRECTORY. If the input path does not match the path in PG_DIRECTORY, an error indicating that the path does not exist is reported.
    • When the GUC parameter safe_data_path is enabled, you can only use an advanced package to operate files in the file path specified by safe_data_path.

    dest_file_name

    TEXT

    IN

    No

    Target file name

    overwrite

    BOOLEAN

    IN

    Yes

    The default value is false. If a file with the same name exists in the destination directory, the file will not be rewritten.

  • PKG_UTIL.FILE_SIZE

    Returns the size of a specified file.

    The prototype of the PKG_UTIL.FILE_SIZE function is as follows:

    1
    2
    3
    bigint PKG_UTIL.FILE_SIZE(
    file_name IN TEXT
    )return BIGINT
    
    Table 46 PKG_UTIL.FILE_SIZE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file_name

    TEXT

    IN

    No

    File name

  • PKG_UTIL.FILE_BLOCK_SIZE

    Returns the number of blocks contained in a specified file.

    The prototype of the PKG_UTIL.FILE_BLOCK_SIZE function is as follows:

    1
    2
    3
    bigint PKG_UTIL.FILE_BLOCK_SIZE(
    file_name IN TEXT
    )return BIGINT
    
    Table 47 PKG_UTIL.FILE_BLOCK_SIZE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file_name

    TEXT

    IN

    No

    File name

  • PKG_UTIL.FILE_EXISTS

    Checks whether a file exists.

    The prototype of the PKG_UTIL.FILE_EXISTS function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_EXISTS(
    file_name IN TEXT
    )
    RETURN BOOL
    
    Table 48 PKG_UTIL.FILE_EXISTS parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file_name

    TEXT

    IN

    No

    File name

  • PKG_UTIL.FILE_GETPOS

    Specifies the offset of a returned file, in bytes.

    The prototype of the PKG_UTIL.FILE_GETPOS function is as follows:

    1
    2
    3
    4
    PKG_UTIL.FILE_GETPOS(
    file IN INTEGER 
    )
    RETURN BIGINT
    
    Table 49 PKG_UTIL.FILE_GETPOS parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

  • PKG_UTIL.FILE_SEEK

    Adjusts the position of a file pointer forward or backward based on the specified number of bytes.

    The prototype of the PKG_UTIL.FILE_SEEK function is as follows:

    1
    2
    3
    4
    5
    void PKG_UTIL.FILE_SEEK(
    file IN INTEGER,
    start IN BIGINT
    )
    RETURN VOID
    
    Table 50 PKG_UTIL.FILE_SEEK parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    file

    INTEGER

    IN

    No

    Opened file handle.

    start

    BIGINT

    IN

    No

    File offset, in bytes.

  • PKG_UTIL.FILE_CLOSE_ALL

    Closes all file handles opened in a session.

    The prototype of the PKG_UTIL.FILE_CLOSE_ALL function is as follows:

    PKG_UTIL.FILE_CLOSE_ALL(
    )
    RETURN VOID
    Table 51 PKG_UTIL.FILE_CLOSE_ALL parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    None

    None

    None

    None

    None

  • PKG_UTIL.EXCEPTION_REPORT_ERROR

    Throws an exception.

    The prototype of the PKG_UTIL.EXCEPTION_REPORT_ERROR function is as follows:

    1
    2
    3
    4
    5
    6
    PKG_UTIL.EXCEPTION_REPORT_ERROR(
    code INTEGER,
    log TEXT,
    flag BOOLEAN DEFAULT FALSE
    )
    RETURN INTEGER
    
    Table 52 PKG_UTIL.EXCEPTION_REPORT_ERROR parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    code

    Integer

    IN

    No

    Error code displayed when a running exception occurs.

    log

    TEXT

    IN

    No

    Log information displayed when a running exception occurs.

    flag

    BOOLEAN

    IN

    Yes

    Reserved. The default value is FALSE.

  • PKG_UTIL.APP_READ_CLIENT_INFO

    Reads the client information.

    The prototype of the PKG_UTIL.APP_READ_CLIENT_INFO function is as follows:

    1
    2
    3
    PKG_UTIL.APP_READ_CLIENT_INFO(
    OUT buffer TEXT
    )return TEXT
    
    Table 53 PKG_UTIL.APP_READ_CLIENT_INFO parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    buffer

    TEXT

    OUT

    No

    Client information returned

  • PKG_UTIL.APP_SET_CLIENT_INFO

    Sets the client information.

    The prototype of the PKG_UTIL.APP_SET_CLIENT_INFO function is as follows:

    1
    2
    3
    PKG_UTIL.APP_SET_CLIENT_INFO(
    str TEXT
    )
    
    Table 54 PKG_UTIL.APP_SET_CLIENT_INFO parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    str

    TEXT

    IN

    No

    Client information to be set

  • PKG_UTIL.LOB_CONVERTTOBLOB

    Converts a CLOB to a BLOB. amount indicates the conversion length.

    The prototype of the PKG_UTIL.LOB_CONVERTTOBLOB function is as follows:

    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_CONVERTTOBLOB(
    dest_lob BLOB, 
    src_clob CLOB, 
    amount INTEGER, 
    dest_offset INTEGER, 
    src_offset INTEGER
    )return RAW
    
    Table 55 PKG_UTIL.LOB_CONVERTTOBLOB parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    BLOB

    IN

    No

    Target LOB.

    src_clob

    CLOB

    IN

    No

    CLOB to be converted.

    amount

    INTEGER

    IN

    No

    Conversion length

    dest_offset

    INTEGER

    IN

    No

    Start position of the target LOB.

    src_offset

    INTEGER

    IN

    No

    Start position of the source CLOB.

  • PKG_UTIL.lLOB_CONVERTTOCLOB

    Converts a BLOB to a CLOB. amount indicates the conversion length.

    The prototype of the PKG_UTIL.LOB_CONVERTTOCLOB function is as follows:

    1
    2
    3
    4
    5
    6
    7
    PKG_UTIL.LOB_CONVERTTOCLOB(
    dest_lob CLOB, 
    src_blob BLOB, 
    amount INTEGER, 
    dest_offset INTEGER, 
    src_offset INTEGER
    )return TEXT
    
    Table 56 PKG_UTIL.LOB_CONVERTTOCLOB parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    dest_lob

    CLOB

    IN

    No

    Target LOB.

    src_blob

    BLOB

    IN

    No

    BLOB to be converted.

    amount

    INTEGER

    IN

    No

    Conversion length.

    dest_offset

    INTEGER

    IN

    No

    Start position of the target LOB.

    src_offset

    INTEGER

    IN

    No

    Start position of the source CLOB.

  • PKG_UTIL.LOB_TEXTTORAW

    Converts the text type to the raw type.

    The prototype of the PKG_UTIL.LOB_TEXTTORAW function is as follows:

    1
    2
    3
    4
    PKG_UTIL.LOB_TEXTTORAW(
    src_lob CLOB
    )
    RETURN RAW
    
    Table 57 PKG_UTIL.LOB_TEXTTORAW parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    src_lob

    CLOB

    IN

    No

    LOB to be converted.

  • PKG_UTIL.LOB_RAWTOTEXT

    Converts RAW data to TEXT data.

    The prototype of the PKG_UTIL.LOB_RAWTOTEXT function is as follows:

    1
    2
    3
    4
    PKG_UTIL.LOB_RAWTOTEXT(
    src_lob IN BLOB
    )
    RETURN TEXT
    
    Table 58 PKG_UTIL.LOB_RAWTOTEXT parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    src_lob

    BLOB

    IN

    No

    LOB to be converted.

  • PKG_UTIL.MATCH_EDIT_DISTANCE_SIMILARITY

    Calculates the difference between two character strings.

    The prototype of the PKG_UTIL.MATCH_EDIT_DISTANCE_SIMILARITY function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.MATCH_EDIT_DISTANCE_SIMILARITY(
    str1 TEXT, 
    str2 TEXT
    )
    RETURN INTEGER
    
    Table 59 PKG_UTIL.MATCH_EDIT_DISTANCE_SIMILARITY parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    str1

    TEXT

    IN

    No

    First character string

    str2

    TEXT

    IN

    No

    Second character string

  • PKG_UTIL.RAW_CAST_TO_VARCHAR2

    Converts the raw type to the varchar2 type.

    The prototype of the PKG_UTIL.RAW_CAST_TO_VARCHAR2 function is as follows:

    1
    2
    3
    4
    PKG_UTIL.RAW_CAST_TO_VARCHAR2(
    str RAW
    )
    RETURN VARCHAR2
    
    Table 60 PKG_UTIL.RAW_CAST_TO_VARCHAR2 parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    str

    RAW

    IN

    No

    Hexadecimal string

  • PKG_UTIL.SESSION_CLEAR_CONTEXT

    Clears the session context.

    The prototype of the PKG_UTIL.SESSION_CLEAR_CONTEXT function is as follows:

    1
    2
    3
    4
    5
    6
    PKG_UTIL.SESSION_CLEAR_CONTEXT(
    namespace TEXT, 
    client_identifier TEXT, 
    attribute TEXT
    )
    RETURN INTEGER
    
    Table 61 PKG_UTIL.SESSION_CLEAR_CONTEXT parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    namespace

    TEXT

    IN

    No

    Namespace of an attribute.

    client_identifier

    TEXT

    IN

    Yes

    Usually same as the value of namespace. If this parameter is set to null, all namespaces are modified by default.

    attribute

    TEXT

    IN

    No

    Attribute value to be cleared

  • PKG_UTIL.SESSION_SEARCH_CONTEXT

    Searches for an attribute value.

    The prototype of the PKG_UTIL.SESSION_SEARCH_CONTEXT function is as follows:

    1
    2
    3
    4
    5
    PKG_UTIL.SESSION_SEARCH_CONTEXT(
    namespace TEXT, 
    attribute TEXT
    )
    RETURN INTEGER
    
    Table 62 PKG_UTIL.SESSION_SEARCH_CONTEXT parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    namespace

    TEXT

    IN

    No

    Namespace of an attribute.

    attribute

    TEXT

    IN

    No

    Attribute value to be searched for.

  • PKG_UTIL.SESSION_SET_CONTEXT

    Sets an attribute value.

    The prototype of the PKG_UTIL.SESSION_SET_CONTEXT function is as follows:

    1
    2
    3
    4
    5
    6
    PKG_UTIL.SESSION_SET_CONTEXT(
    namespace TEXT, 
    attribute TEXT,
    value TEXT
    )
    RETURN INTEGER
    
    Table 63 PKG_UTIL.SESSION_SET_CONTEXT parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    namespace

    TEXT

    IN

    No

    Namespace of an attribute.

    attribute

    TEXT

    IN

    No

    Attribute to be set.

    value

    TEXT

    IN

    No

    Attribute value.

  • PKG_UTIL.UTILITY_GET_TIME

    Prints the Unix timestamp.

    The prototype of the PKG_UTIL.UTILITY_GET_TIME function is as follows:

    1
    2
    PKG_UTIL.UTILITY_GET_TIME()
    RETURN BIGINT
    
  • PKG_UTIL.UTILITY_FORMAT_ERROR_BACKTRACE

    Displays the error stack of a stored procedure.

    The prototype of the PKG_UTIL.UTILITY_FORMAT_ERROR_BACKTRACE function is as follows:

    1
    2
    PKG_UTIL.UTILITY_FORMAT_ERROR_BACKTRACE()
    RETURN TEXT
    
  • PKG_UTIL.UTILITY_FORMAT_ERROR_STACK

    Displays the error information about a stored procedure.

    The prototype of the PKG_UTIL.UTILITY_FORMAT_ERROR_STACK function is as follows:

    1
    2
    PKG_UTIL.UTILITY_FORMAT_ERROR_STACK()
    RETURN TEXT
    
  • PKG_UTIL.UTILITY_FORMAT_CALL_STACK

    Displays the call stack of a stored procedure.

    The prototype of the PKG_UTIL.UTILITY_FORMAT_CALL_STACK function is as follows:

    1
    2
    PKG_UTIL.UTILITY_FORMAT_CALL_STACK()
    RETURN TEXT
    
  • PKG_UTIL.UTILITY_COMPILE_SCHEMA

    Recompiles packages, functions and stored procedures under the specified schema.

    The prototype of the PKG_UTIL.UTILITY_COMPILE_SCHEMA function is as follows:

    PKG_UTIL.UTILITY_COMPILE_SCHEMA (
    schema IN VARCHAR2,
    compile_all IN BOOLEAN DEFAULT TRUE,
    reuse_settings IN BOOLEAN DEFAULT FALSE
    )
    RETURNS VOID
  • PKG_UTIL.GS_COMPILE_SCHEMA

    Recompiles packages, functions and stored procedures under the specified schema.

    The prototype of the PKG_UTIL.GS_COMPILE_SCHEMA stored procedure is as follows:

    pkg_util.GS_COMPILE_SCHEMA (
    schema_name IN VARCHAR2 DEFAULT NULL,
    compile_all IN BOOLEAN DEFAULT FALSE,
    retry_times IN INT DEFAULT 10
    )
    Table 64 PKG_UTIL.GS_COMPILE_SCHEMA parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    schema_name

    VARCHAR2

    IN

    Yes

    Specifies the name of the namespace.

    compile_all

    Boolean

    IN

    Yes

    Specifies to compile all objects.

    • false: Compile the packages, functions, and stored procedures whose status is false in the pg_object table.
    • true: Compile all packages, functions, and stored procedures in the pg_object table.
    • retry_times: number of retry times.
  • PKG_UTIL.APP_SET_MODULE

    Sets the value of a module.

    The prototype of the PKG_UTIL.APP_SET_MODULE stored procedure is as follows:

    PKG_UTIL.APP_SET_MODULE (
        str TEXT)
    returns VOID
    Table 65 PKG_UTIL.APP_SET_MODULE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    text

    Text

    IN

    No

    Specifies the value of a module to be set.

    Example:
    CALL PKG_UTIL.APP_SET_MODULE('set module');
     app_set_module 
    ----------------
    
    (1 row)
  • PKG_UTIL.APP_READ_MODULE

    Reads the value of a module.

    The prototype of the PKG_UTIL.APP_READ_MODULE stored procedure is as follows:

    PKG_UTIL.APP_READ_MODULE(
    OUT buffer TEXT
    )
    Table 66 PKG_UTIL.APP_READ_MODULE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    buffer

    TEXT

    OUT

    No

    Specifies the value of a module to be returned.

    Example:
    DECLARE
          module VARCHAR2(64);
    BEGINPKG_UTIL.APP_READ_MODULE(module);
          dbe_output.print_line(module);
    END;
    /
    set module
    ANONYMOUS BLOCK EXECUTE
  • PKG_UTIL.APP_SET_ACTION

    Sets the value of an action.

    The prototype of the PKG_UTIL.APP_SET_ACTION stored procedure is as follows:

    PKG_UTIL.APP_SET_ACTION (
        str TEXT)
    returns VOID
    Table 67 PKG_UTIL.APP_SET_ACTION parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    text

    Text

    IN

    No

    Specifies the value of an action to be set.

    Example:
    CALL PKG_UTIL.APP_SET_ACTION('set action');
     app_set_action 
    ----------------
    
    (1 row)
  • PKG_UTIL.APP_READ_ACTION

    Reads the value of an action.

    The prototype of the PKG_UTIL.APP_READ_ACTION stored procedure is as follows:

    PKG_UTIL.APP_READ_ACTION(
    OUT buffer TEXT
    )
    Table 68 PKG_UTIL.APP_READ_ACTION parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    buffer

    TEXT

    OUT

    No

    Specifies the value of an action to be returned.

    Example:
    DECLARE
           action VARCHAR2(64);
    BEGINPKG_UTIL.APP_READ_ACTION(action);
          dbe_output.print_line(action);
    END;
    /
    set action
    ANONYMOUS BLOCK EXECUTE
  • PKG_UTIL.MODIFY_PACKAGE_STATE

    Modifies the PL/SQL status of the current session.

    The prototype of the PKG_UTIL.MODIFY_PACKAGE_STATE stored procedure is as follows:

    PKG_UTIL.MODIFY_PACKAGE_STATE (
        flags INT)
    returns VOID
    Table 69 PKG_UTIL.MODIFY_PACKAGE_STATE parameters

    Parameter

    Type

    Input/Output Parameter

    Can Be Empty

    Description

    flags

    INT

    IN

    No

    Bit flag of the operation performed on the PL/SQL.

    When flags is set to 1, the session cache of the PL/SQL that is currently running in the session is released after the top-level PL/SQL is executed. The current value of any package is cleared globally and the cached cursor is closed. On subsequent use, PL/SQL re-instantiates and re-initializes the package globally.

    Other bit flags are not supported.

    Example:
    CALL PKG_UTIL.MODIFY_PACKAGE_STATE(1);
     modify_package_state 
    ----------------------
    
    (1 row)