DB2 10.5 for Linux, UNIX, and Windows

CREATE FUNCTION MAPPING statement

The CREATE FUNCTION MAPPING statement can define a mapping between a federated database function or function template and a data source function, or disable a default mapping between a federated database function and a data source function.

When defining a mapping, the CREATE FUNCTION MAPPING statement can associate the federated database function or template with a function at the following sources:
  • A specified data source
  • A range of data sources; for example, all data sources of a particular type and version

If multiple function mappings are applicable to a function, the most recent one is applied.

Invocation

This statement can be embedded in an application program or issued through the use of dynamic SQL statements. It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is in effect for the package (SQLSTATE 42509).

Authorization

The privileges held by the authorization ID of the statement must include DBADM authority.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-CREATE FUNCTION MAPPING--+-----------------------+--FOR------>
                            '-function-mapping-name-'        

                       .-,-------------.        
                       V               |        
>--+-function-name--(----+-----------+-+--)-+------------------->
   |                     '-data-type-'      |   
   '-SPECIFIC--specific-name----------------'   

>--+-SERVER--server-name------------------------------------------------------------------+-->
   '-SERVER TYPE--server-type--+--------------------------------------------------------+-'   
                               '-VERSION--| server-version |--+-----------------------+-'     
                                                              '-WRAPPER--wrapper-name-'       

>--+----------------------+--+------------+--------------------><
   '-| function-options |-'  '-WITH INFIX-'   

server-version

|--+-version--+------------------------+-+----------------------|
   |          '-.--release--+--------+-' |   
   |                        '-.--mod-'   |   
   '-version-string-constant-------------'   

function-options

               .-,-------------------------------------.      
               V                                       |      
|--OPTIONS -(----function-option-name--string-constant-+--)-----|

Description

function-mapping-name
Names the function mapping. The name must not identify a function mapping that is already described in the catalog (SQLSTATE 42710).

If the function-mapping-name is omitted, a system-generated unique name is assigned.

function-name
Specifies the qualified or unqualified name of the federated database function or federated database function template from which to map.
data-type
For a function or function template that has input parameters, data-type specifies the data type of each parameter. The data type cannot be an XML or a user-defined type.

Empty parentheses can be used instead of specifying length, precision, or scale for the parameterized data types. It is recommended to use empty parentheses for the parameterized data types; for example, CHAR(). A parameterized data type is any one of the data types that can be defined with a specific length, scale, or precision. The parameterized data types are the string data types and the decimal data types. If you specify length, precision, or scale, it must be the same as that of the function template. If you omit parentheses altogether, the default length for the data type is used (see the description of the CREATE TABLE statement).

SPECIFIC specific-name
Identifies the function or function template from which to map. Specify specific-name to create a convenient function name.
SERVER server-name
Names the data source containing the function that is being mapped.
SERVER TYPE server-type
Identifies the type of data source containing the function that is being mapped.
VERSION
Identifies the version of the data source denoted by server-type.
version
Specifies the version number. The value must be an integer.
release
Specifies the number of the release of the version denoted by version. The value must be an integer.
mod
Specifies the number of the modification of the release denoted by release. The value must be an integer.
version-string-constant
Specifies the complete designation of the version. The version-string-constant can be a single value (for example, '8i'); or it can be the concatenated values of version, release and, if applicable, mod (for example, '8.0.3').
WRAPPER wrapper-name
Specifies the name of the wrapper that the federated server uses to interact with data sources of the type and version denoted by server-type and server-version.
OPTIONS
Indicates what function mapping options are to be enabled.
function-option-name
Names a function mapping option that applies either to the function mapping or to the data source function included in the mapping.
string-constant
Specifies the setting for function-option-name as a character string constant.
WITH INFIX
Specifies that the data source function be generated in infix format. The federated database system converts prefix notation to the infix notation that is used by the remote data source.

Notes

Examples