Complex User-Defined Types Design Time: Artifact Generation

9-98 Oracle Fusion Middleware Users Guide for Technology Adapters

9.7.3.9 Referencing Types in Other Schemas

You can refer to types defined in other schemas if the necessary privileges to access them have been granted. For example, suppose type OBJ was declared in SCHEMA1: SQL CREATE TYPE OBJ AS OBJECT …; The type of a parameter in a stored procedure declared in SCHEMA2 can be type OBJ from SCHEMA1: CREATE PROCEDURE PROC O IN SCHEMA1.OBJ AS BEGIN … END; This is possible only if SCHEMA1 granted permission to SCHEMA2 to access type OBJ: SQL GRANT EXECUTE ON OBJ TO SCHEMA2; If the required privileges are not granted, an error occurs when trying to create procedure PROC in SCHEMA2: PLS-00201: identifier SCHEMA1.OBJ must be declared Because the privileges have not been granted, type OBJ from SCHEMA1 is not visible to SCHEMA2; therefore, SCHEMA2 cannot refer to it in the declaration of parameter O.

9.7.3.10 XSD Pruning Optimization

Some user-defined object types can have a very large number of attributes. These attributes can also be defined in terms of other object types that also have many attributes. In short, one object type can become quite large depending on the depth and complexity of its definition. Depending on the situation, many attributes of a large object type may not even be necessary. It is therefore sometimes desirable to omit these attributes from the objects schema definition altogether. This can be done by physically removing the unwanted XSD elements from the definition of the object type. Consider the following example where a stored procedure has a parameter whose type is a complex user-defined type: SQL CREATE TYPE OBJ AS OBJECT A, NUMBER, B SqlType, C SqlType, ...; SQL CREATE PROCEDURE PROC O OBJ AS BEGIN ... END; The InputParameters root element contains a single element for the parameter, O from the APIs signature. A complexType definition is to be added to the generated XSD for the object type, as shown in the following code snippet: complexType name=OBJ sequence element name=A type=decimal db:type=NUMBER minOccurs=0 nillable=true element name=B ... element name=C ... ... sequence complexType If attributes B and C are not required, then their element in the complexType definition of OBJ can be removed regardless of its type. Values are not required for these attributes in the instance XML. If parameter O had been an output parameter, then elements corresponding with the pruned attributes are also omitted in the generated XML.