|Oracle8i Supplied PL/SQL Packages Reference
Release 2 (8.1.6)
Part Number A76936-01
Oracle8i supports user-defined composite type or object type. Any instance of an object type is called an object. An object type can be used as the type of a column or as the type of a table.
In an object table, each row of the table stores an object. You can uniquely identify an object in an object table with an object identifier.
A reference is a persistent pointer to an object, and each reference can contain an object identifier. The reference can be an attribute of an object type, or it can be stored in a column of a table. Given a reference, an object can be retrieved.
UTL_REF package provides PL/SQL procedures to support reference-based operations. Unlike SQL,
UTL_REF procedures enable you to write generic type methods without knowing the object table name.
The procedural option is needed to use this package. This package must be created under
SYS (connect internal). Operations provided by this package are performed under the current calling user, not under the package owner
An object type is a composite datatype defined by the user or supplied as a library type. You can create the object type
employee_type using the following syntax:
CREATE TYPE employee_type AS OBJECT (
The object type
employee_type is a user-defined type that contains two attributes,
id, and a member function,
You can create an object table using the following SQL syntax:
Exceptions can be returned during execution of
UTL_REF functions for various reasons. For example, the following scenarios would result in exceptions:
UTL_REFsubprogram must have the proper privilege on the object that is being selected or modified.
Unable to serialize, if in a serializable transaction.
No data found (if the
UTL_REF package does not define any named exceptions. You may define exception handling blocks to catch specific exceptions and to handle them appropriately.
You can use the
UTL_REF package from stored PL/SQL procedures/packages on the server, as well as from client/side PL/SQL code.
When invoked from PL/SQL procedures/packages on the server,
UTL_REF verifies that the invoker has the appropriate privileges to access the object pointed to by the
UTL_REF is defined under user
SYS, and user A invokes
SELECT to select an object from a reference, then user A (the invoker) requires the privileges to check.
When invoked from client-side PL/SQL code,
UTL_REF operates with the privileges of the client session under which the PL/SQL execution is being done.