Add Update Map Procedures This page last changed on Nov 27, 2008. .stickable, h1, h2, h3, h4, h5 false true Show Sticky notes Hide Sticky notes Save Cancel Oracle Data Service Integrator Documentation > Data Services Developer's Guide # How To Add Update Map Procedures This topic describes how to add a create, update, or delete procedure to a logical entity service. Overview Generate Default Procedures Design Custom Procedures See Also ## Overview In a logical entity service, you can add create, update, and delete procedures (called update map procedures) that act on underlying data sources. A procedure is an operation that can have side effects, for example, a create procedure that adds a new record to a database table and returns a key value. You can create update map procedures visually in Workshop for WebLogic and have the framework generate XQuery pragma statements and source code, or you can write the source code directly in XQuery or XQSE. The XQuery pragma statement looks something like this:
    (::pragma  function <f:function kind="create" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.bea.com">
This statement defines a create procedure, with public visibility, that is primary. Even though the pragma statement uses the keyword function, the operation you define is a procedure, as you can see from the declaration:
    declare procedure cus:createCustomerAndAddress($arg as element(cus:CustomerAndAddress)*) as element(cus:CustomerAndAddress_KEY)\* external;
This line declares the procedure with the name createCustomerAndAddress, defines one argument with the service's return type, and specifies a key as a return value. ## Generate Default Procedures When you generate default update map procedures, they have these parameters and return values:
Type | Parameters | Return Value
--- | --- | ---
Create | The service's Return type | The current key, empty if no key is defined
Update | The service's Return type using a changed-element kind | Empty
Delete | The service's return type | Empty
Before you create update map procedures, especially create procedures, add a key to your service. A primary create procedure must return a key. Primary update and delete procedures require the Return type as an argument; their non-primary equivalents can be written to accept a key instead. To generate a default update map procedure: Create a key for your service. In the Overview tab, right-click at the left, right, or top, and choose Add Update Map Procedures. Select Add to indicate which procedures to add. Add names in the Name fields. Mark Primary to indicate if each procedure should be primary. Click OK. In the Overview tab, right-click a procedure name and choose Edit Signature. Make any necessary changes to the procedure signature in the dialog box. ## Design Custom Procedures You can also create procedures with the arguments and return types you choose. This is useful for procedures in addition to the primary create, update, and delete procedures. To design custom procedures: Click Overview. Right-click at the top, left, or right, and choose Add Operation. Choose a value for Visibility. At Kind, choose create, update, or delete. At Name, enter a procedure name. (Optional) At Return Type, click Edit. Choose a primitive or complex type, then click OK. At Parameters, click Add. Choose a primitive or complex type from an XML or XSD file, then click OK. At Kind, choose a value. Choose element to use the exact XML element you selected as a parameter; changed-element, if values in the element must be updated; schema-element, if the element must be validated according to an XML schema. At Occurrence, choose a value. Click OK in both dialog boxes. ## See Also ##### Concepts Data Service Keys ##### How Tos Add a Read Function Create Logical Data Service Keys Test a Create or Delete Procedure Test an Update Procedure

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