Data Type Conversions Run Time: After Stored Procedure Invocation

9-104 Oracle Fusion Middleware Users Guide for Technology Adapters

9.7.6.1 Processing ResultSets

All third-party databases share the same functionality for handling ResultSets. The following is a SQL Server example of an API that returns a ResultSet: 1 create procedure foo ... as select ... from ...; 2 go A RowSet defined in the generated XSD represents a ResultSet. A RowSet consists of zero or more rows, each having one or more columns. A row corresponds with a row returned by the query. A column corresponds with a column item in the query. The generated XML for the API shown in the preceding example after it executes is shown in the following example: RowSet Row Column name=column name sqltype=sql datatypevalueColumn ... Row ... RowSet … The name attribute stores the name of the column appearing in the query while the sqltype attribute stores the SQL datatype of that column, for example INT. The value is whatever the value is for that column. Note that it is possible for an API to return multiple ResultSets. In such cases, there is one RowSet for each ResultSet in the generated XML. All RowSets always appear first in the generated XML.

9.7.6.2 Returning an INTEGER Status Value

Some databases support returning an INTEGER status value using a RETURN statement in a stored procedure. Microsoft SQL Server and AS400 both support this feature. In both cases, the Adapter Configuration Wizard is unable to determine whether a stored procedure returns a status value. Therefore, you must specify that the stored procedure is returning a value. You can use a check box to make this indication. After choosing a stored procedure in the Stored Procedures dialog, the Specify Stored Procedure page appears, as shown in Figure 9–49 . The check box appears at the bottom of the page. Select the box to indicate that the procedure contains a RETURN statement. You can view the source code of the procedure to determine whether a RETURN statement exists. Note that the check box appears only for stored procedures on databases that support this feature. The check box is not displayed for functions. The value returned by the stored procedure appears as an element in the OutputParameters root element in the generated XSD. The name of the element is the name of the stored procedure. The value of a return statement is lost after the execution of the stored procedure if the check box is not selected. Oracle JCA Adapter for Database 9-105 Figure 9–49 The Specify Stored Procedure Page

9.7.7 Advanced Topics

This section discusses scenarios for types that are not supported directly using the stored procedure functionality that the Oracle Database Adapter provides. The following sections describe workarounds that address the need to use these data types: ■ Section 9.7.7.1, Row Set Support Using a Strongly Typed XSD ■ Section 9.7.7.2, Row Set Support Using a Weakly Typed XSD ■ Section 9.7.7.3, Support for PLSQL Boolean, PLSQL Record, and PLSQL Table Types

9.7.7.1 Row Set Support Using a Strongly Typed XSD

Currently a REF CURSOR by nature can support any arbitrary result set, so the XSD generated at design time is weakly typed. However the XML output from this is hard to use. It is very difficult to write an Xpath expression or XSL based on a weakly typed XSD and column names as attribute values instead of element names. Although a row set can represent any result set, it is possible to assume for some procedures that it will have the same structure each time, and hence can be described with a strongly typed XSD. A strongly typed XSD is almost a necessity if you want to transform the result set to another XSD later on. You can use the Adapter Configuration Wizard to generate a strongly typed XSD for a REF CURSOR. If a weakly typed XSD is sufficient for your use case, see Section 9.7.7.2, Row Set Support Using a Weakly Typed XSD . This section includes the following topics: ■ Section 9.7.7.1.1, Design Time ■ Section 9.7.7.1.2, Run Time