Understanding and Testing Stored Procedures and Functions Contained in an Oracle Package

Topics:

How to:

An Oracle database allows a developer to create stored procedures and functions that are contained within packages. An Oracle package is used to store related items in a single unit. The iWay Technology Adapter for RDBMS provides access to stored procedures within a package. Each stored procedure is executed separately and in the same manner that a regular stored procedure is executed.

This section describes how to test a stored procedure in an Oracle package and how to generate a schema for the stored procedure.

Procedure: How to Test a Stored Procedure and Function in an Oracle Package

You can test a stored procedure and function in an Oracle package using the same technique as for a regular stored procedure. Perform the following steps to test a stored procedure and function in an Oracle package:

  1. In the left pane, expand the Schemas, Stored Procedures, and Packages nodes.
  2. Right-click the stored procedure or function that you want to test.
  3. Click Test Run.

    Note: Constraints are addressed in the same manner as for a regular stored procedure.

Procedure: How to Generate a Schema for a Stored Procedure Contained in an Oracle Package

To generate a schema for a stored procedure contained in an Oracle package:

  1. If you are not connected to a defined target, connect to one, as described in How to Connect to a Defined Target.
  2. Expand the Schemas node under the desired connection.
  3. Select the database containing the stored procedure for which you want to generate a schema.
  4. Expand the Procedures node.
  5. Expand the Packages node.
  6. Select the stored procedure.
  7. In the right pane, move the pointer over Operations and select Generate Schema.

Examples

This section provides sample request and response documents.

Example: Stored Procedure Request Schema for an Oracle Database

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by the iBSE 2004-01-13T22:12:21Z -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="RDBMS">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="PROCIN">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element name="Y" type="xsd:string"/>
                  </xsd:sequence>
                  <xsd:attribute name="location" type="xsd:string" 
use="optional" fixed="RDBMS/Schemas/EDARPK/Procedures/PROCIN"/>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
</xsd:schema>

Example: Stored Procedure Request Instance Document for an Oracle Database

<?xml version="1.0" encoding="UTF-8"?>
<RDBMS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="D:\iway\RDBMS\PROCIN_request.xsd">
   <PROCIN location="RDBMS/Schemas/EDARPK/Procedures/PROCIN">
      <Y>String</Y>
   </PROCIN>
</RDBMS>

Example: Stored Procedure Response Schema for an Oracle Database

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by the iBSE 2004-01-13T22:18:44Z -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="RESULT">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="PROCIN">
               <xsd:complexType>
                  <xsd:sequence/>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
</xsd:schema>

Example: Stored Procedure Response Instance Document for an Oracle Database

<?xml version="1.0" encoding="UTF-8"?>
<RESULT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="D:\iway\RDBMS\PROCIN_response.xsd">
   <PROCIN/>
</RESULT>