SQL Reference
method-invocation
|--subject-expression..method-name--+--------------------------------+->
'-(--+--------------------+---)--'
| .-,------------. |
| V | |
'----expression---+--'
>---------------------------------------------------------------|
Both system-generated observer and mutator methods, as well as user-defined
methods are invoked using the double-dot operator.
- subject-expression
- An expression with a static result type that is a user-defined structured
type.
- method-name
- The unqualified name of a method. The static type of
subject-expression or one of its supertypes must include a method
with the specified name.
- (expression,...)
- The arguments of method-name are specified within
parentheses. Empty parentheses can be used to indicate that there are
no arguments. The method-name and the data types of the
specified argument expressions are used to resolve to the specific method,
based on the static type of subject-expression (see Method Resolution for more information).
The double-dot operator used for method invocation is a high precedence
left to right infix operator. For example, the following two
expressions are equivalent:
a..b..c + x..y..z
and
((a..b)..c) + ((x..y)..z)
If a method has no parameters other than its subject, it may be invoked
with or without parentheses. For example, the following two expressions
are equivalent:
point1..x
and
point1..x()
Null subjects in method calls are handled as follows:
- If a system-generated mutator method is invoked with a null subject, an
error results (SQLSTATE 2202D)
- If any method other than a system-generated mutator is invoked with a null
subject, the method is not executed, and its result is null. This rule
includes user-defined methods with SELF AS RESULT.
When a database object (a package, view, or trigger, for example) is
created, the best fit method that exists for each of its method invocations is
found using the rules specified in Method Resolution.
Note: |
- Methods of types defined WITH FUNCTION ACCESS can also be invoked using
the regular function notation. Function resolution considers all
functions, as well as methods with function access as candidate
functions. However, functions cannot be invoked using method
invocation. Method resolution considers all methods and does not
consider functions as candidate methods. Failure to resolve to an
appropriate function or method results in an error (SQLSTATE
42884).
|
[ Top of Page | Previous Page | Next Page ]