Download Creating User-Defined Routines and User-Defined Data

Transcript
Granting Privileges for an Opaque Data Type
Granting Privileges for an Opaque Data Type
After you create the opaque data type and register it with the database, use
the GRANT statement to define the following privileges on this data type:
■
Privileges on the use of the opaque data type
■
Privileges on the support functions of the opaque data type
The CREATE OPAQUE TYPE statement creates a new opaque data type with
the Usage privilege granted to the owner of the opaque data type and the
DBA. To use the opaque data type in an SQL statement, you must have the
Usage privilege. The owner can grant the Usage privilege to other users with
the USAGE ON TYPE clause of the GRANT statement.
The database server checks for the Usage privilege whenever the opaquetype name appears in an SQL statement (such as a column data type in
CREATE TABLE or a cast data type in CREATE CAST). The database server does
not check for the Usage privilege when an SQL statement:
■
Accesses columns of the opaque data type
The Select, Insert, Update, and Delete table-level privileges determine access to a column.
■
Invokes a UDR with the opaque data type as an argument
The Execute routine privilege determines access to a UDR.
For example, the following GRANT statement assigns the Usage privilege on
the circle opaque data type to user dexter:
GRANT USAGE ON TYPE circle TO dexter
The sysxtdtypeauth system catalog table stores data type-level privileges.
This table contains privileges for each opaque and distinct data type that is
defined in the database. The table contains one row for each set of privileges
granted.
For information about setting the privileges for support functions, refer to
“Setting Privileges for Support Functions” on page 10-7.
Creating an Opaque Data Type 9-17