During the insert, the ADDRESS_TY constructor method is
used, and KAREN_SHELL owns it. Therefore, the insert command must be modified to specify
KAREN_SHELL as the owner of ADDRESS_TY. The following example shows the corrected insert
statement, with the reference to KAREN_SHELL shown in bold:
insert into CON_K_CUSTOMERS values
(1,PERSON_TY('John Doe',
KAREN_SHELL.ADDRESS_TY('101 Main Street','Dodgeville','WI',53595)));
Solving this problem is easy: as of Oracle Database 10g, you can create and use a public
synonym for a datatype. Continuing with the previous examples, KAREN_SHELL can create a
public synonym like so and grant EXECUTE privileges on the type:
create public synonym pub_address_ty for address_ty;
grant execute on address_ty to public;
As a result, any user, including CON_K, can now reference the type using the synonym for
creating new tables or types:
create or replace type person_ty as object
(name varchar2(25),
address pub_address_ty);
In a relational-only implementation of Oracle, you grant the EXECUTE privilege on procedural
objects, such as procedures and packages. Within the object-relational implementation of Oracle,
the EXECUTE privilege is extended to cover abstract datatypes as well, as you can see in the example
earlier in this section. The EXECUTE privilege is used because abstract datatypes can include
methods??”PL/SQL functions and procedures that operate on the datatypes. If you grant someone
the privilege to use your datatype, you are granting the user the privilege to execute the methods
you have defined on the datatype.
Pages:
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286