com.ibm.db.models.db2
Interface DB2Function

All Superinterfaces:
commonj.sdo.DataObject, DB2AccessPlan, DB2Routine, org.eclipse.emf.ecore.sdo.EDataObject, org.eclipse.emf.ecore.EModelElement, org.eclipse.emf.ecore.ENamedElement, org.eclipse.emf.ecore.EObject, org.eclipse.emf.common.notify.Notifier, org.eclipse.wst.rdb.internal.models.sql.routines.Routine, java.io.Serializable, org.eclipse.wst.rdb.internal.models.sql.schema.SQLObject
All Known Subinterfaces:
DB2Method, DB2UserDefinedFunction
All Known Implementing Classes:
DB2MethodImpl, DB2UserDefinedFunctionImpl

public interface DB2Function
extends DB2Routine

A representation of the model object 'DB2 Function'. SQL Reference for Cross-Platform Development - v1.1 http://www7b.software.ibm.com/dmdd/library/techarticle/0206sqlref/0206sqlref.html Functions (Chapter 1. Concepts 9) A function is a routine that can be invoked from within other SQL statements and returns a value, or a table. For more information, see "Functions" on page 93. Functions (Chapter 2. Language elements 93) A function is an operation denoted by a function name followed by zero or more operands that are enclosed in parentheses. It represents a relationship between a set of input values and a set of result values. The input values to a function are called arguments. For example, a function can be passed two input arguments that have date and time data types and return a value with a timestamp data type as the result. Types of functions: There are several ways to classify functions. One way to classify functions is as built-in, user-defined, or generated user-defined functions for distinct types. - Built-in functions are functions that come with the database manager. These functions provide a single-value result. Built-in functions include operator functions such as ??+??, column functions such as AVG, and scalar functions such as SUBSTR. For a list of the built-in column and scalar functions and information on these functions, see Chapter 3, "Built-in functions", on page 131. The built-in functions are in a product-specific schema. - User-defined functions are functions that are created using the CREATE FUNCTION statement and registered to the database manager in the catalog. For more information, see "CREATE FUNCTION" on page 325. These functions allow users to extend the function of the database manager by adding their own or third party vendor function definitions. A user-defined function is an SQL, external, or sourced function. An SQL function is defined to the database using only an SQL RETURN statement. An external function is defined to the database with a reference to an external program that is executed when the function is invoked. A sourced function is defined to the database with a reference to a built-in function or another user-defined function. Sourced functions can be used to extend built-in column and scalar functions for use on distinct types. A user-defined function resides in the schema in which it was created. - Generated user-defined functions for distinct types are functions that the database manager automatically generates when a distinct type is created using the CREATE DISTINCT TYPE statement. These functions support casting from the distinct type to the source type and from the source type to the distinct type. The ability to cast between the data types is important because a distinct type is compatible only with itself. The generated user-defined functions for distinct types reside in the same schema as the distinct type for which they were created. For more information about the functions that are generated for a distinct type, see "CREATE DISTINCT TYPE" on page 319. Another way to classify functions is as column, scalar, or table functions, depending on the input data values and result values. - A column function receives a set of values for each argument (such as the values of a column) and returns a single-value result for the set of input values. Column functions are sometimes called aggregating functions. Built-in functions and user-defined sourced functions can be column functions. - A scalar function receives a single value for each argument and returns a single-value result. Built-in functions and user-defined functions can be scalar functions. Generated user-defined functions for distinct types are also scalar functions. - A table function returns a table for the set of arguments it receives. Each argument is a single value. A table function can be referenced only in the FROM clause of a subselect. A table function can be defined as an external function, but a table function cannot be a sourced function. Table functions can be used to apply SQL language processing power to data that is not data that is not stored in the database or to allow access to such data as if it were stored in a result table. For example, a table function can take a file and convert it to a table, get data from the Web and tabularize it, or access a Lotus Notes database and return information about email messages.

The following features are supported:

See Also:
DB2ModelPackage.getDB2Function()

Field Summary
static java.lang.String COLUMN_TYPE
          Pseudo-enumerated value for type.
static java.lang.String ROW_TYPE
          Pseudo-enumerated value for type.
static java.lang.String SCALAR_TYPE
          Pseudo-enumerated value for type.
static java.lang.String TABLE_TYPE
          Pseudo-enumerated value for type.
 
Fields inherited from interface com.ibm.db.models.db2.DB2Routine
CLEAN, DIRTY, DIRTY_DDL
 
Method Summary
 int getCardinality()
          Returns the value of the 'Cardinality' attribute.
 java.lang.String getFunctionType()
          Returns the value of the 'Function Type' attribute.
 OriginType getOrigin()
          Returns the value of the 'Origin' attribute.
 java.lang.String getPredicate()
          Returns the value of the 'Predicate' attribute.
 java.lang.String getReturnClause()
          Returns the value of the 'Return Clause' attribute.
 int getScratchPadLength()
          Returns the value of the 'Scratch Pad Length' attribute.
 boolean isAllowParallel()
          Returns the value of the 'Allow Parallel' attribute.
 boolean isExternalAction()
          Returns the value of the 'External Action' attribute.
 boolean isFinalCall()
          Returns the value of the 'Final Call' attribute.
 boolean isInheritLockRequest()
          Returns the value of the 'Inherit Lock Request' attribute.
 boolean isScratchPad()
          Returns the value of the 'Scratch Pad' attribute.
 void setAllowParallel(boolean value)
          Sets the value of the 'Allow Parallel' attribute.
 void setCardinality(int value)
          Sets the value of the 'Cardinality' attribute.
 void setExternalAction(boolean value)
          Sets the value of the 'External Action' attribute.
 void setFinalCall(boolean value)
          Sets the value of the 'Final Call' attribute.
 void setFunctionType(java.lang.String value)
          Sets the value of the 'Function Type' attribute.
 void setInheritLockRequest(boolean value)
          Sets the value of the 'Inherit Lock Request' attribute.
 void setOrigin(OriginType value)
          Sets the value of the 'Origin' attribute.
 void setPredicate(java.lang.String value)
          Sets the value of the 'Predicate' attribute.
 void setReturnClause(java.lang.String value)
          Sets the value of the 'Return Clause' attribute.
 void setScratchPad(boolean value)
          Sets the value of the 'Scratch Pad' attribute.
 void setScratchPadLength(int value)
          Sets the value of the 'Scratch Pad Length' attribute.
 
Methods inherited from interface com.ibm.db.models.db2.DB2Routine
getChangeState, getDebugId, getExtendedOptions, getFenced, getOrigParmSig, getOrigSchemaName, getParmCcsid, getProgramType, getRoutineExtensions, getSpecialRegister, getThreadsafe, isDbInfo, isFederated, isImplicitSchema, setChangeState, setDbInfo, setDebugId, setFederated, setFenced, setImplicitSchema, setOrigParmSig, setOrigSchemaName, setParmCcsid, setProgramType, setSpecialRegister, setThreadsafe
 
Methods inherited from interface org.eclipse.wst.rdb.internal.models.sql.routines.Routine
getAuthorizationID, getCreationTS, getExternalName, getInputParameters, getLanguage, getLastAlteredTS, getOutputParameters, getParameters, getParameterStyle, getSchema, getSecurity, getSource, getSpecificName, getSqlDataAccess, isDeterministic, setAuthorizationID, setCreationTS, setDeterministic, setExternalName, setLanguage, setLastAlteredTS, setParameterStyle, setSchema, setSecurity, setSource, setSpecificName, setSqlDataAccess
 
Methods inherited from interface org.eclipse.wst.rdb.internal.models.sql.schema.SQLObject
addEAnnotation, addEAnnotationDetail, getComments, getDependencies, getDescription, getEAnnotation, getEAnnotationDetail, getLabel, getPrivileges, removeEAnnotationDetail, setAnnotationDetail, setDescription, setLabel
 
Methods inherited from interface org.eclipse.emf.ecore.sdo.EDataObject
getInstanceProperties
 
Methods inherited from interface commonj.sdo.DataObject
createDataObject, createDataObject, createDataObject, createDataObject, createDataObject, createDataObject, delete, get, get, get, getBigDecimal, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getBytes, getBytes, getBytes, getChar, getChar, getChar, getContainer, getContainmentProperty, getDataGraph, getDataObject, getDataObject, getDataObject, getDate, getDate, getDate, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInt, getList, getList, getList, getLong, getLong, getLong, getSequence, getSequence, getSequence, getShort, getShort, getShort, getString, getString, getString, getType, isSet, isSet, isSet, set, set, set, setBigDecimal, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBigInteger, setBoolean, setBoolean, setBoolean, setByte, setByte, setByte, setBytes, setBytes, setBytes, setChar, setChar, setChar, setDataObject, setDataObject, setDataObject, setDate, setDate, setDate, setDouble, setDouble, setDouble, setFloat, setFloat, setFloat, setInt, setInt, setInt, setList, setList, setList, setLong, setLong, setLong, setShort, setShort, setShort, setString, setString, setString, unset, unset, unset
 
Methods inherited from interface org.eclipse.emf.ecore.ENamedElement
getName, setName
 
Methods inherited from interface org.eclipse.emf.ecore.EModelElement
getEAnnotations
 
Methods inherited from interface org.eclipse.wst.rdb.internal.models.sql.schema.SQLObject
addEAnnotation, addEAnnotationDetail, getComments, getDependencies, getDescription, getEAnnotation, getEAnnotationDetail, getLabel, getPrivileges, removeEAnnotationDetail, setAnnotationDetail, setDescription, setLabel
 
Methods inherited from interface org.eclipse.emf.ecore.sdo.EDataObject
getInstanceProperties
 
Methods inherited from interface commonj.sdo.DataObject
createDataObject, createDataObject, createDataObject, createDataObject, createDataObject, createDataObject, delete, get, get, get, getBigDecimal, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getBytes, getBytes, getBytes, getChar, getChar, getChar, getContainer, getContainmentProperty, getDataGraph, getDataObject, getDataObject, getDataObject, getDate, getDate, getDate, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInt, getList, getList, getList, getLong, getLong, getLong, getSequence, getSequence, getSequence, getShort, getShort, getShort, getString, getString, getString, getType, isSet, isSet, isSet, set, set, set, setBigDecimal, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBigInteger, setBoolean, setBoolean, setBoolean, setByte, setByte, setByte, setBytes, setBytes, setBytes, setChar, setChar, setChar, setDataObject, setDataObject, setDataObject, setDate, setDate, setDate, setDouble, setDouble, setDouble, setFloat, setFloat, setFloat, setInt, setInt, setInt, setList, setList, setList, setLong, setLong, setLong, setShort, setShort, setShort, setString, setString, setString, unset, unset, unset
 
Methods inherited from interface org.eclipse.emf.ecore.ENamedElement
getName, setName
 
Methods inherited from interface org.eclipse.emf.ecore.EModelElement
getEAnnotations
 

Field Detail

COLUMN_TYPE

static final java.lang.String COLUMN_TYPE
Pseudo-enumerated value for type. COLUMN_TYPE means the function returns a column.

See Also:
DB2Function#setType(String);, Constant Field Values

SCALAR_TYPE

static final java.lang.String SCALAR_TYPE
Pseudo-enumerated value for type. SCALAR_TYPE means the function returns a scalar.

See Also:
DB2Function#setType(String);, Constant Field Values

TABLE_TYPE

static final java.lang.String TABLE_TYPE
Pseudo-enumerated value for type. TABLE_TYPE means the function returns a table.

See Also:
DB2Function#setType(String);, Constant Field Values

ROW_TYPE

static final java.lang.String ROW_TYPE
Pseudo-enumerated value for type. ROW_TYPE means the function returns a row.

See Also:
DB2Function#setType(String);, Constant Field Values
Method Detail

isFinalCall

boolean isFinalCall()
Returns the value of the 'Final Call' attribute. This optional clause specifies whether a final call is to be made to an external function. The purpose of such a final call is to enable the external function to free any system resources it has acquired. It can be useful in conjunction with the SCRATCHPAD keyword in situations where the external function acquires system resources such as memory and anchors them in the scratchpad.

Returns:
the value of the 'Final Call' attribute.
See Also:
setFinalCall(boolean), DB2ModelPackage.getDB2Function_FinalCall()

setFinalCall

void setFinalCall(boolean value)
Sets the value of the 'Final Call' attribute.

Parameters:
value - the new value of the 'Final Call' attribute.
See Also:
isFinalCall()

isScratchPad

boolean isScratchPad()
Returns the value of the 'Scratch Pad' attribute.
SCRATCHPAD (True)
Indicates whether the function requires a static memory area.
NO SCRATCHPAD (False)
Indicates that the function does not require a persistent memory area.

If True, then there can be an optional length (see scratchPadLength)

Returns:
the value of the 'Scratch Pad' attribute.
See Also:
setScratchPad(boolean), DB2ModelPackage.getDB2Function_ScratchPad()

setScratchPad

void setScratchPad(boolean value)
Sets the value of the 'Scratch Pad' attribute.

Parameters:
value - the new value of the 'Scratch Pad' attribute.
See Also:
isScratchPad()

getScratchPadLength

int getScratchPadLength()
Returns the value of the 'Scratch Pad Length' attribute. If this is null or empty or a string value other than 1..32767, then NO SCRATCHPAD otherwise there will be SCRATCHPAD where the default is 100, the same as if no length was specified. NO SCRATCHPAD or SCRATCHPAD length This optional clause may be used to specify whether a scratchpad is to be provided for an external function. (It is strongly recommended that user-defined functions be re-entrant, so a scratchpad provides a means for the function to "save state" from one call to the next.) SCRATCHPAD is not supported for PARAMETER STYLE JAVA functions.

Returns:
the value of the 'Scratch Pad Length' attribute.
See Also:
setScratchPadLength(int), DB2ModelPackage.getDB2Function_ScratchPadLength()

setScratchPadLength

void setScratchPadLength(int value)
Sets the value of the 'Scratch Pad Length' attribute.

Parameters:
value - the new value of the 'Scratch Pad Length' attribute.
See Also:
getScratchPadLength()

getFunctionType

java.lang.String getFunctionType()
Returns the value of the 'Function Type' attribute.

Please refer to the defined constants at the beginning of this module for the values to use when passing in the argument.

The valid values to indicate the function type are: C (Column) S (Scaler) T (Table) R (Row)

Returns:
the value of the 'Function Type' attribute.
See Also:
setFunctionType(String), DB2ModelPackage.getDB2Function_FunctionType()

setFunctionType

void setFunctionType(java.lang.String value)
Sets the value of the 'Function Type' attribute.

Please refer to the defined constants at the beginning of this module for the values to use when passing in the argument.

Parameters:
value - the new value of the 'Function Type' attribute.
See Also:
getFunctionType()

getPredicate

java.lang.String getPredicate()
Returns the value of the 'Predicate' attribute. Defines the filtering and/or index extension exploitation performed when this function is used in a predicate. A predicate-specification allows the optional SELECTIVITY clause of a search-condition to be specified. If the PREDICATES clause is specified, the function must be defined as DETERMINISTIC with NO EXTERNAL ACTION (SQLSTATE 42613).

Returns:
the value of the 'Predicate' attribute.
See Also:
setPredicate(String), DB2ModelPackage.getDB2Function_Predicate()

setPredicate

void setPredicate(java.lang.String value)
Sets the value of the 'Predicate' attribute.

Parameters:
value - the new value of the 'Predicate' attribute.
See Also:
getPredicate()

isExternalAction

boolean isExternalAction()
Returns the value of the 'External Action' attribute. This optional clause specifies whether or not the function takes some action that changes the state of an object not managed by the database manager. Optimizations that assume functions have no external impacts are prevented by specifying EXTERNAL ACTION. For example: sending a message, ringing a bell, or writing a record to a file.

Returns:
the value of the 'External Action' attribute.
See Also:
setExternalAction(boolean), DB2ModelPackage.getDB2Function_ExternalAction()

setExternalAction

void setExternalAction(boolean value)
Sets the value of the 'External Action' attribute.

Parameters:
value - the new value of the 'External Action' attribute.
See Also:
isExternalAction()

getCardinality

int getCardinality()
Returns the value of the 'Cardinality' attribute. From the UDB 7.1 documentation for CREATE FUNCTION (External Table): This optional clause provides an estimate of the expected number of rows to be returned by the function for optimization purposes. Valid values for integer range from 0 to 2,147,483,647 inclusive. If the CARDINALITY clause is not specified for a table function, DB2 will assume a finite value as a default- the same value assumed for tables for which the RUNSTATS utility has not gathered statistics. Warning: if a function does in fact have infinite cardinality, i.e. it returns a row every time it is called to do so, never returning the .end-of-table. condition, then queries which require the .end-of-table. condition to correctly function will be infinite, and will have to be interrupted. Examples of such queries are those involving GROUP BY and ORDER BY. The user is advised to not write such UDFs.

Returns:
the value of the 'Cardinality' attribute.
See Also:
setCardinality(int), DB2ModelPackage.getDB2Function_Cardinality()

setCardinality

void setCardinality(int value)
Sets the value of the 'Cardinality' attribute.

Parameters:
value - the new value of the 'Cardinality' attribute.
See Also:
getCardinality()

isAllowParallel

boolean isAllowParallel()
Returns the value of the 'Allow Parallel' attribute. This optional clause specifies whether, for a single reference to the function, the invocation of the function can be parallelized. In general, the invocations of most scalar functions should be parallelizable, but there may be functions (such as those depending on a single copy of a scratchpad) that cannot. If either ALLOW PARALLEL or DISALLOW PARALLEL are specified for a scalar function, then DB2 will accept this specification. The syntax diagram indicates that the default value is ALLOW PARALLEL. However, the default is DISALLOW PARALLEL if one or more of the following options is specified in the statement: NOT DETERMINISTIC EXTERNAL ACTION SCRATCHPAD FINAL CALL MODIFIES SQL DATA (version 8)

Returns:
the value of the 'Allow Parallel' attribute.
See Also:
setAllowParallel(boolean), DB2ModelPackage.getDB2Function_AllowParallel()

setAllowParallel

void setAllowParallel(boolean value)
Sets the value of the 'Allow Parallel' attribute.

Parameters:
value - the new value of the 'Allow Parallel' attribute.
See Also:
isAllowParallel()

getReturnClause

java.lang.String getReturnClause()
Returns the value of the 'Return Clause' attribute. Contains the text of the SQL statement in the RETURN temporary until we hook in the SQLStatement portion of the model.

Returns:
the value of the 'Return Clause' attribute.
See Also:
setReturnClause(String), DB2ModelPackage.getDB2Function_ReturnClause()

setReturnClause

void setReturnClause(java.lang.String value)
Sets the value of the 'Return Clause' attribute.

Parameters:
value - the new value of the 'Return Clause' attribute.
See Also:
getReturnClause()

getOrigin

OriginType getOrigin()
Returns the value of the 'Origin' attribute. The literals are from the enumeration OriginType.

If the meaning of the 'Origin' attribute isn't clear, there really should be more of a description here...

Returns:
the value of the 'Origin' attribute.
See Also:
OriginType, setOrigin(OriginType), DB2ModelPackage.getDB2Function_Origin()

setOrigin

void setOrigin(OriginType value)
Sets the value of the 'Origin' attribute.

Parameters:
value - the new value of the 'Origin' attribute.
See Also:
OriginType, getOrigin()

isInheritLockRequest

boolean isInheritLockRequest()
Returns the value of the 'Inherit Lock Request' attribute.

If the meaning of the 'Inherit Lock Request' attribute isn't clear, there really should be more of a description here...

Returns:
the value of the 'Inherit Lock Request' attribute.
See Also:
setInheritLockRequest(boolean), DB2ModelPackage.getDB2Function_InheritLockRequest()

setInheritLockRequest

void setInheritLockRequest(boolean value)
Sets the value of the 'Inherit Lock Request' attribute.

Parameters:
value - the new value of the 'Inherit Lock Request' attribute.
See Also:
isInheritLockRequest()