1. Test a Create or Delete Procedure This page last changed on Nov 28, 2008. # How To Test a Create or Delete Procedure This topic describes how to test a create procedure or delete procedure in a logical data service. Overview Edit a Complex Parameter in Test View Use the Result of a Read Function See Also ## Overview Testing a create or delete procedure shows you how data is inserted into or deleted from physical data sources. A create or delete can insert data into or delete it from multiple physical data sources, of the same or different types. If possible, you should test a create or delete procedure on sample data first, before you test on live physical data sources. A create procedure usually takes a complex type argument of the service's return type, and returns a key value as a result. You can see the procedure's argument and return type by right-clicking the procedure in the Overview tab and choosing Edit Signature. ##### A Create Procedure Signature You can see the element (or elements) defined in the return key in the update map. ##### The Return Key of a Create Procedure For relational sources, the return key value is generated using either identity or sequence, depending on how the relational table was created. A delete procedure also takes a complex argument, usually the service's return type or a key, but it often does not return a value. ##### A Delete Procedure Signature Oracle Data Service Integrator sequences the updates done by create and delete procedures to ensure referential integrity, in that: Child elements are deleted before parent elements Parent elements are inserted before child elements ## Edit a Complex Parameter in Test View To test the create or delete procedure, you can edit the fields of the XML complex type provided in Test view, or you can browse for an XML document that contains a template with the required data. To test a create or delete procedure using an XML template: Click the Test tab. At Select Operation, choose the create or delete procedure. Enter data in the Parameters box by doing one of the following: Enter data values directly in the XML template. Click Browse to locate an XML document that contains the data. Expand Settings and check the authentication credentials. Click Run. If you are testing a Create procedure, you will see the key data displayed in the Result pane. ##### The Returned Key Value ### When You Enter Data Whether you edit data values directly in the XML template provided in the Test tab or browse for an XML document, be careful to: Use data of the correct data type for each element.
   | String values do not need quotation marks.
3. Add a value for each required element in the complex parameter. Delete optional elements for which you do not provide values, for example:
       <!--Optional:-->
       <STREET_ADDRESS2>string</STREET_ADDRESS2>
4. Be sure that the prefix binding and namespace used in the XML argument are correct for your data service, for example:
       <cus:CUSTOMER_PROFILE xmlns:cus="ld:logical/CustomerProfile">
The default template that Oracle Data Service Integrator usually has the correct namespace binding. You can also check the bindings by clicking the Overview tab, then Properties. Respect referential integrity constraints. In other words, if an element refers to a key value in another relational table, be sure to enter a valid key value. ## Use the Result of a Read Function If the XML argument is complex and you do not want to enter all necessary values in the Test tab or create an XML document, you can also run one of the service's Read functions and copy the data from the result. To test a create or delete procedure using the result of a read function: Click the Test tab. Run a read function (see Test a Read Function and Simple Update). Click the Text radio button. Scroll down in the results to locate the data record you want. Copy it to the clipboard. In Test view, choose a create procedure. Paste the XML data in the argument box. Edit the data, then click Run. Run the Read function again, to check that the data record was inserted or deleted. This is an example of a data record returned by a Read function, which you can copy from the Text view:
    <?xml version="1.0" encoding="UTF-8"?>
    <cus:CUSTOMER_PROFILE xmlns:cus="ld:logical/CustomerProfile">
        <CUSTOMER>
            <CUSTOMER_ID>CUSTOMER9</CUSTOMER_ID>
            <FIRST_NAME>Hommer</FIRST_NAME>
            <LAST_NAME>Simpson</LAST_NAME>
            <EMAIL_ADDRESS>JOHN_9@yahoo.com</EMAIL_ADDRESS>
            <ADDRESS>
                <ADDR_ID>ADDR_9_0</ADDR_ID>
                <CUSTOMER_ID>CUSTOMER9</CUSTOMER_ID>
                <STREET_ADDRESS1>179 Rose Avenue</STREET_ADDRESS1>
                <STREET_ADDRESS2>NULL</STREET_ADDRESS2>
                <CITY>Las Vegas</CITY>
                <STATE>NV</STATE>
                <ZIPCODE>89502</ZIPCODE>
                <COUNTRY>USA</COUNTRY>
            </ADDRESS>
            <CREDITRATING>
                <CUSTOMER_ID>CUSTOMER9</CUSTOMER_ID>
                <RATING>600</RATING>
            </CREDITRATING>
        </CUSTOMER>
    </cus:CUSTOMER_PROFILE>
- Be sure to remove: The XML declaration at the top:
      <?xml version="1.0" encoding="UTF-8"?>
- Any optional elements for which you do not supply values:
      <!--Optional:-->
            <STREET_ADDRESS2>string</STREET_ADDRESS2>
## See Also ##### Concepts Understanding Update Maps ##### How Tos Test a Read Function and Simple Update Test an Update Procedure

Document generated by Confluence on Jan 13, 2009 15:57