Generated XSD Attributes Design Time: Artifact Generation

Oracle JCA Adapter for Database 9-95 restriction base=string maxLength value=10 restriction simpleType sequence complexType The minOccurs value is 0 to allow for an empty collection. The maxOccurs value is set to the maximum number of items that the collection can hold. Note that the db:index attribute is not used. Having nillable set to true allows individual items in the VARRAY to be null. Note the use of the restriction specified on the element of the VARRAY, FOO. This is used on types such as CHAR and VARCHAR2, whose length is known from the declaration of the VARRAY or nested table. It specifies the type and maximum length of the element. An element value that exceeds the specified length causes the instance XML to fail during schema validation. The attribute values of a parameter declared to be of type FOO look as follows in the generated XSD: element name=X type=db:FOO db:type=Array db:index=1 minOccurs=0 nillable=true The type and db:type values indicate that the parameter is represented as an array defined by the complexType called FOO in the XSD file. The value for db:index is whatever the position of that parameter is in the stored procedure. A nested table is treated almost identically to a VARRAY. The following nested table type definition, SQL CREATE TYPE FOO AS TABLE OF VARCHAR2 10; is also generated as a complexType with a single element in its sequence, called name _ITEM. The element has the same attributes as in the VARRAY example, except that the maxOccurs value is unbounded because nested tables can be of arbitrary size. complexType name=FOO sequence element name=X_ITEM … maxOccurs=unbounded nillable=true … element sequence complexType An identical restriction is generated for the X_ITEM element in the VARRAY. The attributes of a parameter, X, declared to be of this type, are the same as in the VARRAY example. Note that collections Varray and nested table are not supported if they are defined inside of a PLSQL package specification. For example: SQL create package pkg as type vary is varray10 of number; type ntbl is table of varchar2100; procedure testv in vary, n in ntbl; end; If a user selects the test procedure in the Adapter Configuration Wizard for stored procedures, an error occurs stating that the types are not supported. However, if the 9-96 Oracle Fusion Middleware Users Guide for Technology Adapters vary and ntbl type definitions were defined at the root level, outside of the package, then choosing the test procedure works without issue. The supported way to use collection types Varray and nested table is shown in the following example: SQL create type vary as varray10 of number; SQL create type ntbl as table of varchar210; SQL create package pkg as procedure testv in vary, n in ntbl; end; An OBJECT definition is also generated as a complexType. Its sequence holds one element for each attribute in the OBJECT. The following OBJECT, SQL CREATE TYPE FOO AS OBJECT X VARCHAR2 10, Y NUMBER; is represented as a complexType definition called FOO with two sequence elements. complexType name=FOO sequence element name=X db:type=VARCHAR2 minOccurs=0 nillable=true simpleType restriction base=string maxLength value=10 restriction simpleType element name=Y type=decimal db:type=NUMBER minOccurs=0 nillable=true sequence complexType The minOccurs value is 0 to allow for the element to be removed from the XML file. This causes the value of the corresponding attribute in the OBJECT to be set to null at run time. The nillable value is true to allow empty elements to appear in the XML file, annotated with the xsi:nil attribute, to indicate that the value of the element is null. Again, the db:index attribute is not used. Note the use of a restriction on the VARCHAR2 attribute. The length is known from the declaration of the attribute in the OBJECT.

9.7.3.6 Complex User-Defined Types