XSD Pruning Optimization Design Time: Artifact Generation

9-100 Oracle Fusion Middleware Users Guide for Technology Adapters In the second and third cases, the actual value extracted from the XML file is null. The type converter accepts null and returns it without any conversion. The null value is bound to its corresponding parameter regardless of its type. Essentially, this is the same as passing null for parameter X. The fourth case has two possibilities. The parameter either has a default clause or it does not. If the parameter has a default clause, then the parameter can be excluded from the invocation of the stored procedure. This allows the default value to be used for the parameter. If the parameter is included, then the value of the parameter is used, instead. If the parameter does not have a default clause, then the parameter must be included in the invocation of the procedure. Elements for all parameters of a function must be specified. If an element in the instance XML is missing, then the function is invoked with fewer arguments than is expected. A null value is bound to the parameter by default: SQL CREATE PROCEDURE PROC X IN INTEGER DEFAULT 0 AS BEGIN … END; Here, no value is bound to the parameter. In fact, the parameter can be excluded from the invocation of the stored procedure. This allows the value of 0 to default for parameter X. To summarize, the following PLSQL is executed in each of these three cases: 1. BEGIN PROC X=?; END; - X = 100 2. BEGIN PROC X=?; END; - X = null 3. There are two possibilities: a. BEGIN PROC ; END; - X = 0 X has a default clause b. BEGIN PROC X=?; END; - X = null X does not have a default clause With the exception of default clause handling, these general semantics also apply to item values of a collection or attribute values of an OBJECT whose types are one of the supported primitive data types. The semantics of X when the type is user-defined are, however, quite different. For a collection, whether it is a VARRAY or a nested table, the following behavior can be expected, given a type definition such as SQL CREATE TYPE ARRAY AS VARRAY 5 OF VARCHAR2 10; and XML for a parameter, X, which has type ARRAY, that appears as follows: X X_ITEM xsi:nil=true X_ITEMHelloX_ITEM X_ITEM xsi:nil=true X_ITEMWorldX_ITEM X The first and third elements of the VARRAY are set to null. The second and fourth are assigned their respective values. No fifth element is specified in the XML file; therefore, the VARRAY instance has only four elements. Assume an OBJECT definition such as SQL CREATE TYPE OBJ AS OBJECT A INTEGER, B INTEGER, C INTEGER; and XML for a parameter, X, which has type OBJ, that appears as Oracle JCA Adapter for Database 9-101 X A100A C xsi:nil=true X The value 100 is assigned to attribute A, and null is assigned to attributes B and C. Because there is no element in the instance XML for attribute B, a null value is assigned. The second case, X, behaves differently if the type of X is user-defined. Rather than assigning null to X, an initialized instance of the user-defined type is created and bound instead. In the preceding VARRAY example, if X or XX is specified, then the value bound to X is an empty instance of the VARRAY. In PLSQL, this is equivalent to calling the type constructor and assigning the value to X. For example, X := ARRAY; Similarly, in the preceding OBJECT example, an initialized instance of OBJ, whose attribute values have all been null assigned, is bound to X. Similar to the VARRAY case, this is equivalent to calling the type constructor. For example, X := OBJNULL, NULL, NULL; To specifically assign a null value to X when the type of X is user-defined, add the xsi:nil attribute to the element in the XML file, as in X xsi:nil=true

9.7.4.2 Data Type Conversions

This section describes the conversion of data types such as CLOB, DATE, TIMESTAMP, and binary data types including RAW, LONG RAW and BLOB, as well as similar data types supported by third-party databases. Microsoft SQL Server, IBM DB2, AS400, and MySQL support binding various forms of binary and date data types to parameters of a stored procedure, as summarized in Table 9–19 . For a CLOB parameter, if the length of the CLOB parameter is less than 4 kilobytes, then the text extracted from the XML file is bound to the parameter as a String type with Table 9–19 Third-Party Database: Binding Binary and Date Values to Parameters of a Stored Procedure XML Schema Type IBM DB2 Data Type AS400 Data Type Microsoft SQL Server Data Type MySQL Data Type base64Binary BLOB CHAR FOR BIT DATA VARCHAR FOR BIT DATA BINARY BINARY LARGE OBJECT BINARY VARYING BINARY IMAGE TIMESTAMP VARBINARY BINARY TINYBLOB BLOB MEDIUMBLOB LONGBLOB VARBINARY dateTime DATE TIME TIMESTAMP DATE TIME TIMESTAMP DATETIME SMALLDATETIME DATE DATETIME TIMESTAMP