Updated on 2023-10-23 GMT+08:00

PKG_UTIL

Table 1 lists all interfaces supported by the PKG_UTIL package.

Table 1 PKG_UTIL

Interface

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 a specified number of characters of 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.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_BINARY_INTEGER

Converts binary integers to RAW data.

PKG_UTIL.RAW_CAST_TO_BINARY_INTEGER

Converts RAW data to binary integers.

PKG_UTIL.SET_RANDOM_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 a file 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_GET_LENGTH

    This function obtains the length of the input data.

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

    1
    2
    3
    4
    PKG_UTIL.LOB_GET_LENGTH(
    lob       IN   anyelement
    )
    RETURN INTEGER;
    
    Table 2 PKG_UTIL.LOB_GET_LENGTH interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    lob

    clob/blob

    IN

    No

    Indicates the object whose length is to be obtained.

  • PKG_UTIL.LOB_READ

    This function 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 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    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

    This function 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      int
    )
    RETURN BLOB;
    PKG_UTIL.LOB_WRITE(
    dest_lob    INOUT   clob,
    src_lob     IN      varchar2
    len         IN      int,
    start_pos   IN      int
    )
    RETURN CLOB;
    
    Table 4 PKG_UTIL.LOB_WRITE interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    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

    int

    IN

    No

    Specifies the write start position of the target object.

  • PKG_UTIL.LOB_APPEND

    This function 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 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    dest_lob

    blob/clob

    INOUT

    No

    Specifies the target BLOB/CLOB that data will be written to.

    src_lob

    blob/clob

    IN

    No

    Specifies the source BLOB/CLOB to be written.

    len

    int

    IN

    Yes

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

  • PKG_UTIL.LOB_COMPARE

    This function 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 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    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

    This function 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 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    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

    This function 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 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    lob

    blob

    IN

    No

    Indicates 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.IO_PRINT

    This function 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 9 PKG_UTIL.IO_PRINT interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    format

    text

    IN

    No

    Indicates the character string to be output.

    is_one_line

    boolean

    IN

    No

    Indicates whether to output the string as a line.

  • PKG_UTIL.RAW_GET_LENGTH

    This function 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 10 PKG_UTIL.RAW_GET_LENGTH interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    raw

    raw

    IN

    No

    Indicates the object whose length is to be obtained.

  • PKG_UTIL.RAW_CAST_FROM_VARCHAR2

    This function 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 11 PKG_UTIL.RAW_CAST_FROM_VARCHAR2 interface parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    str

    varchar2

    IN

    No

    Indicates the source data to be converted

  • PKG_UTIL.RANDOM_SET_SEED

    This function 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 12 PKG_UTIL.RANDOM_SET_SEED parameters

    Parameter

    Type

    Input/Output Parameter

    Empty or Not

    Description

    seed

    int

    IN

    No

    Sets a random seed.

  • PKG_UTIL.RANDOM_GET_VALUE

    The RANDOM_GET_VALUE function 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

    This function 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 13 PKG_UTIL.FILE_SET_DIRNAME interface parameters

    Parameter

    Description

    dirname

    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

    This function 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 14 PKG_UTIL.FILE_OPEN interface parameters

    Parameter

    Description

    file_name

    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

    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

    This function 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 15 PKG_UTIL.FILE_SET_MAX_LINE_SIZE interface parameters

    Parameter

    Description

    max_line_size

    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

    This function 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 16 PKG_UTIL.FILE_IS_CLOSE interface parameters

    Parameter

    Description

    file

    Opened file handle

  • PKG_UTIL.FILE_READ

    This function 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 17 PKG_UTIL.FILE_READ interface parameters

    Parameter

    Description

    file

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

    buffer

    Buffer used to receive data

    len

    Number of bytes read from a file

  • PKG_UTIL.FILE_READLINE

    This function 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 18 PKG_UTIL.FILE_READLINE interface parameters

    Parameter

    Description

    file

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

    buffer

    Buffer used to receive data

    len

    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

    This function 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 19 PKG_UTIL.FILE_WRITE interface parameters

    Parameter

    Description

    file

    Opened file handle

    buffer

    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

    This function 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 20 PKG_UTIL.FILE_NEWLINE interface parameters

    Parameter

    Description

    file

    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 21 PKG_UTIL.FILE_WRITELINE parameters

    Parameter

    Description

    file

    Opened file handle

    buffer

    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 22 PKG_UTIL.FILE_READ_RAW interface parameters

    Parameter

    Description

    file

    Opened file handle

    length

    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

    This function writes the input binary object RAW to an opened 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 23 PKG_UTIL.FILE_WRITE_RAW parameters

    Parameter

    Description

    file

    Opened file handle

    r

    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 24 PKG_UTIL.FILE_FLUSH interface parameters

    Parameter

    Description

    file

    Opened file handle

  • PKG_UTIL.FILE_CLOSE

    This function 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 25 PKG_UTIL.FILE_CLOSE interface parameters

    Parameter

    Description

    file

    Opened file handle

  • PKG_UTIL.FILE_REMOVE

    This function 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 26 PKG_UTIL.FILE_REMOVE interface parameters

    Parameter

    Description

    filen_ame

    Name of the file to be deleted

  • PKG_UTIL.FILE_RENAME

    The function 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 27 PKG_UTIL.FILE_RENAME interface parameters

    Parameter

    Description

    src_dir

    Source file directory (case-sensitive)

    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.
    • When the GUC parameter safe_data_path is enabled, you can only use the advanced package to read and write files in the file path specified by safe_data_path.

    src_file_name

    Source file name

    dest_dir

    Target file directory (case-sensitive)

    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.
    • When the GUC parameter safe_data_path is enabled, you can only use the advanced package to read and write files in the file path specified by safe_data_path.

    dest_file_name

    Target file name

    overwrite

    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

    This function 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 28 PKG_UTIL.FILE_SIZE interface parameters

    Parameter

    Description

    file_name

    File name

  • PKG_UTIL.FILE_BLOCK_SIZE

    This function 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 29 PKG_UTIL.FILE_BLOCK_SIZE interface parameters

    Parameter

    Description

    file_name

    File name

  • PKG_UTIL.FILE_EXISTS

    This function 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 30 PKG_UTIL.FILE_EXISTS interface parameters

    Parameter

    Description

    file_name

    File name

  • PKG_UTIL.FILE_GETPOS

    This function 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 31 PKG_UTIL.FILE_GETPOS interface parameters

    Parameter

    Description

    file

    Opened file handle

  • PKG_UTIL.FILE_SEEK

    This function 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 32 PKG_UTIL.FILE_SEEK interface parameters

    Parameter

    Description

    file

    Opened file handle

    start

    File offset, in bytes.

  • PKG_UTIL.FILE_CLOSE_ALL

    This function 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 33 PKG_UTIL.FILE_CLOSE_ALL interface parameters

    Parameter

    Description

    None

    None

  • PKG_UTIL.EXCEPTION_REPORT_ERROR

    This function 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 34 PKG_UTIL.EXCEPTION_REPORT_ERROR interface parameters

    Parameter

    Description

    code

    Error code displayed when an exception occurs.

    log

    Log information displayed when an exception occurs.

    flag

    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 35 PKG_UTIL.app_read_client_info parameters

    Parameter

    Description

    buffer

    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 36 PKG_UTIL.app_set_client_info interface parameters

    Parameter

    Description

    str

    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 37 PKG_UTIL.lob_converttoblob interface parameters

    Parameter

    Description

    dest_lob

    Target LOB

    src_clob

    CLOB to be converted

    amount

    Conversion length

    dest_offset

    Start position of the target LOB

    src_offset

    Start position of the source CLOB

  • PKG_UTIL.lob_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 38 PKG_UTIL.lob_converttoclob interface parameters

    Parameter

    Description

    dest_lob

    Target LOB

    src_blob

    BLOB to be converted

    amount

    Conversion length

    dest_offset

    Start position of the target LOB

    src_offset

    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 39 PKG_UTIL.lob_texttoraw parameters

    Parameter

    Description

    src_lob

    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 40 PKG_UTIL.match_edit_distance_similarity parameters

    Parameter

    Description

    str1

    First character string

    str2

    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 41 PKG_UTIL.raw_cast_to_varchar2 interface parameters

    Parameter

    Description

    str

    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 42 PKG_UTIL.session_clear_context parameters

    Parameter

    Description

    namespace

    Namespace of an attribute

    client_identifier

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

    attribute

    Attribute value to be cleared

  • PKG_UTIL.session_search_context

    Searches for an attribute value.

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

    1
    2
    3
    4
    5
    PKG_UTIL.session_clear_context(
    namespace text, 
    attribute text
    )
    RETURN INTEGER
    
    Table 43 PKG_UTIL.session_clear_context parameters

    Parameter

    Description

    namespace

    Namespace of an attribute

    attribute

    Attribute value to be cleared

  • 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 44 PKG_UTIL.session_set_context parameters

    Parameter

    Description

    namespace

    Namespace of an attribute

    attribute

    Attribute to be set

    value

    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