You can use the Function editor to create and maintain the user-defined functions in a DB2 physical model.
To define a DB2 function
The Function Editor opens.
Note: Click New on the toolbar to create a function. Use the Enter filter text text box to filter a large list of functions to locate the one you want to work with.
Specifies the name of the function.
Specifies the schema to associate with the function. Select a schema name from the drop-down list.
Specifies if the function is at the Model Level or Table Level. Select a type from the drop-down list.
Specifies the type of function. Select a value from the drop-down list: SQL Scalar, SQL Table, SQL Row, External Scalar, External Table, or Sourced.
Specifies the location of the function with respect to the table definition in the Forward Engineering script. Select from the drop-down list; valid values are Post-Creation and Pre-Creation.
For example, if you select Post-Creation, the function appears after the table definition.
Specifies whether or not to use the CREATE or REPLACE command instead of the CREATE command during Forward Engineering.
Note: This field applies to DB2 for LUW version 9.7 only.
Specifies whether or not you want to attach this function automatically to a new table.
Specifies whether or not to generate DDL for this object during Forward Engineering.
Specifies the input parameters of the function. Specify one entry for each parameter that the function receives.
Specifies the physical data type of the parameter.
Specifies whether the data type is for binary data.
Specifies another object that is used to define a parameter data type.
Specifies the name of the global variable that is anchored to the selected parameter. This field appears when you select the value for Anchored to Type as Variable or Cursor Variable.
Specifies the abstract entity for a column. This field appears when you select the value for Anchored to Type as Column or Table, or View Row.
Specifies the name of the column anchored to the selected parameter. This field appears when you select the value for Anchored to Type as Column.
Specifies a unique name for the instance of the function that is being defined. This name can be used when sourcing on this function, dropping the function, or commenting on the function. However, this name cannot be used to invoke the function.
Return Options:
Specifies the data type for the value returned by the function. Select a data type from the drop-down list.
Specifies the character type that is returned. Select from the drop-down list; valid values are For Bit Data.
Specifies the data type to which the return data type is anchored to.
Specifies the name of the global variable that is anchored to the selected parameter. This field appears when you select the value for Return Data Type Anchored to Type as Variable or Cursor Variable.
Specifies the abstract entity for a column. This field appears when you select the value for Return Data Type Anchored to Type as Column or Table Row.
Specifies the name of the column anchored to the selected parameter. This field appears when you select the value for Return Data Type Anchored to Type as Column.
Specifies the name of the external table, when the type is set to External Table. Select a table name from the drop-down list.
Specifies the data type to which the result returned from the function is casted. This option appears when the type is set to External Scalar.
Specifies the character type of the casted data type returned by the function. This option displays when the type is set to External Scalar.
Specifies the language in which the function is written. Select from the drop-down list. Valid values are: C, Java, OLE, OLE DB, CLR, and SQL.
Specifies the coded character set identifier. Select from the drop-down list. Valid values are ASCII and UNICODE.
Specifies whether the function always returns the same results for given argument values.
Specifies whether or not the function can change the state of an object that the database manager does not manage.
Specifies the type of SQL statements that can be executed. Select a value from the drop-down list. Valid values are: Modifies SQL Data, Reads SQL Data, and Contains SQL Data.
Specifies whether or not at function resolution time, DB2 chooses a function based on the static types (declared types) of the parameters of the function.
Specifies that the function is called regardless of whether any of its arguments are null. The function can return a null value or a non-null value. Select a value from the drop-down list; valid values are Called and Returns Null.
Specifies how special registers are set on entry to the routine. Select a value from the drop-down list: Inherit.
Specifies whether or not a lock request can be associated with the isolation-clause of the statement when the function inherits the isolation level of the statement that invokes the function.
Specifies the conventions used for passing parameters to and returning the value from functions. Select a value from the drop-down list. Valid values are DB2 General, Java, SQL, and DB2 SQL.
Specifies that the function runs in an external address space to prevent user programs from corrupting DB2 storage.
Specifies whether the function is considered safe to run in the same process as other routines.
Indicates that when the function is invoked for the first time, DB2 allocates memory for a scratchpad.
When using the Scratch Pad option, indicates the SCRATCHPAD length.
Specifies whether a final call is made to an external function. This option enables the external function to free any system resources it is using.
Specifies that parallel processing is allowed.
Specifies whether or not status information known by DB2 is passed to the stored procedure when it is invoked.
Specifies an estimate of the expected number of rows that the function returns. Enter an integer in the text box.
Specifies the name of the function or function template.
Specifies the specific name of the sourced function.
Specifies the schema for the sourced function. Select a schema name from the drop-down list.
Identifies the user-written code that implements the function.
Specifies the file name of the file containing the function. Select from the drop-down list or create a file using the DB2 for LUW File Editor.
Specifies the class identifier, which the database manager invokes to execute the user-defined function being created.
Specifies the method identifier, which the database manager invokes to execute the user-defined function being created.
Specifies the operator used compare the use of the function in the predicate. The operator can be ″=″, ″<″, ″>″, ″>=″, ″<=″, or ″<>″.
Specifies whether the function is being compared with a constant or an expression.
Specifies the expression name, which can be used as a search function argument.
Specifies an external function or a case expression, which can be used for additional filtering of the result table.
Indicates that the index lookup is exact in terms of the predicate evaluation. Using EXACT means that neither the original user-defined predicate function nor the filter is applied after the index lookup.
Specifies the index extension that you want to use with the predicate. Select from the drop-down list or create an extension using the DB2 for LUW Index Extension Editor.
Specifies a set of rules in terms of the search method of an index extension that can be used to exploit the index.
Specifies which search method to use from those defined in the index extension. You can select from the list or create a method using the DB2 for LUW Index Extension Exploitation Rule Editor.
The DB2 for LUW Function Editor closes.
Copyright © 2017 erwin Inc.
All rights reserved.
|
|