Using the Same Sessions for Both Invokes

9-30 Oracle Fusion Middleware Users Guide for Technology Adapters

9.3.2 Pure SQL - XML Type Support

Pure SQL Adapter is an option in the Oracle Database Adapter Wizard that allows you to type the SQL string directly and have an XSDWeb service generated automatically. The database tables are introspected dynamically in the Adapter Configuration Wizard to test the SQL and populate the XSD file better that is, with valid return types. The Pure SQL support allows the Oracle Database Adapter to deal with tablesviews as entities and for dealing directly with SQL. You can use Pure SQL: ■ for simple data projection style report queries ■ in cases where the result set is not table oriented, such as select count ■ to perform an update or delete all ■ when working with XMLType columns and xquery ■ when using complex SQL, which are not modeled in the Adapter Configuration Wizard expression builder You can use the Pure SQL Adapter with Oracle XMLTypes. It is a natural fit for inserting XML into XMLType tables and columns, and retrieving XML using xquery selects. Pure SQL is a natural fit for the Oracle Database Adapter that provides a relational-xml mapping that parallels XML DBXDB support. So, when using XDB the adapter should be as lightweight and transparent as possible, to let you focus on XDB and XQuery. If your data is in XML unstructuredsemi-structured format, and you have no relational schema at all that you can map your data to, then you could use XDB. The conventional Oracle Database Adapter allows you to import an existing relational schema as an XML schema to be used with Web services. XDBs XML shredding algorithm can generate a relational schema from an existing XML schema for persistent storage. For more information, see: ■ Section 9.2.4, Selecting the Operation Type ■ Use Cases for Pure SQL on page 9-53

9.3.3 Row Set Support Using a Strongly or Weakly Typed XSD

Currently a REF CURSOR by nature can support any arbitrary result set, so the XSD generated at design time allows this and looks like the XSD that Example 9–1 shows. Example 9–1 Weakly Typed XSD refCursorOutputParam Note: Use of schema bound XMLTypes requires the oci driver, which is not certified in the 11g release. Therefore, you must use non-schema bound XMLTypes at run time, though you can use schema bound XMLTypes at design time to import a representative XSD. Note: Oracle Database stored procedures return result sets that are referred to as RefCursors, whereas, in the case of third-party databases result sets that are returned are referred to as RowSets. Oracle JCA Adapter for Database 9-31 Row Column name=DEPTNO sqltype=NUMBER20Column ... Row refCursorOutputParam 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. A strongly typed XSD looks like the XSD that Example 9–2 shows. Example 9–2 Strongly Typed XSD refCursorOutputParam dept deptno20deptno ... dept refCursorOutputParam You can use the Adapter Configuration Wizard to create a strongly typed XSD for a row set returned by a stored procedure or function REF CURSOR variable. An Oracle Database function is a special stored procedure that always has one out variable, and can be inlined - for example, inside select statements - and so traditionally does not do updates. Using this feature, you can select a stored procedure or stored function, enter its arguments, and perform a test execution to retrieve an actual row set. The Adapter Configuration Wizard then introspects the returned row set and generates a strongly typed XSD. You can enter arguments easily through the wizard. For example, you can enter numbers and strings directly, dates as literals 20091111, and you can even enter structs like MYOBJa, b. The Adapter Configuration Wizard row set support using a strongly typed XSD has the following restrictions: ■ Oracle Database PLSQL record or boolean types are not supported. ■ Oracle Database PLSQL varray is not supported. ■ Oracle Database PLSQL rowtype is not supported. ■ Oracle Database PLSQL table types are not supported. ■ Oracle Database PLSQL procedures with IN only REF CURSOR parameters are not supported. For an Oracle Database PLSQL procedure with REF CURSOR as an INOUT parameter, the Adapter Configuration Wizard ignores the IN and generates the strongly typed XSD based on the OUT parameter. ■ Referencing an element in the XSD using ref is not supported. Note: Functions are not supported for IBM DB2 UDB. Only SQL stored procedures are supported.