Understand Mappings with Different Data Types
This page last changed on Nov 28, 2008.
Oracle Data Service Integrator Documentation > Data Services Developer's Guide How To Understand Mappings with Different Data TypesThis topic describes casts between elements of different data types in an update map. OverviewIn an update map, you may need to map elements of different data types between a return type and an underlying data source. For example, a return type might contain an xsd:dateTime element that maps to an xs:date element in the data source. When data types differ, you need to cast between them in order to enable the update map. Type differences occur because a logical data service design can differ from actual physical data sources or because data types used by an underlying data source are unknown at design time. When the update map is first generated, the element in the data source has no mapping and a warning icon. The Element Initially with No MappingIf you draw a mapping line in Update Map view, from the xsd:dateTime value in the return type to the xsd:date value in the update block, the element becomes disabled. An Error Due to Data Type MismatchYou can fix this type of error by using different techniques to cast, according to the data types you are casting. First, review the built-in datatypes chart in the XML Schema Datatypes specification to understand the hierarchies of data types used in XML Schema. The type xs:string and its subtypes belong to one type hierarchy, and the type xs:decimal and its subtypes belong to another. Casts between elements of different types are handled in one of three ways:
Built-In Cast FunctionsIf a built-in function provides the cast you need, you can simply drag it from the Design Palette to the expression editor and enter argument values. Built-In XQuery Casting FunctionsCustom Cast FunctionsBefore you write a custom XQuery cast function, make sure that XQuery allows the cast you want to perform. Check the casting section in the XQuery 1.0 specification to understand the rules for casting between types in XQuery, especially the chart that describes casting between primitive types. Remember these general guidelines:
Once you write the cast function, you can test it in Workshop for WebLogic, before you run it with a client application. See AlsoHow ToOther Resources |
Document generated by Confluence on Jan 13, 2009 15:57 |