A function call calls a specified function.
function-call::=[authorization-identifier.] routine-identifier
([argument [, argument]...])
argument::=value-expression [AS data-type]
For the default values for an authorization identifier, see 1.1.9 Schema path.
Table 2-87 Rules for determining the specified contents of the function call and the function to be called
Specified contents of the function call | Rules for determining the function to be called | ||
---|---|---|---|
Number of authorization identifiers, routine identifiers, and arguments is the same. | Number of arguments is 0. | Calls the function to make the data types the same for authorization identifiers, routine identifiers, and arguments. | |
Does not include abstract data types in the arguments. | Data types of the parameters are in complete agreement with the order in which arguments are listed.# | ||
Data types of the parameters are not in agreement with the order in which arguments are listed. | Follows the rules described in When an abstract data type is not included, below. | ||
Includes abstract data type in the arguments. | Follows the rules described in When an abstract data type is included, below. | ||
Number of authorization identifiers, routine identifiers, and arguments is not the same. | No function can be called, so an error occurs when the SQL statement is analyzed. |
Table 2-88 Priorities of predefined data types
Data type of argument | Priority order |
---|---|
Numeric data | SMALLINT![]() ![]() ![]() ![]() |
Character data | CHAR![]() |
National character data | NCHAR![]() |
Mixed character data | MCHAR![]() |
Large-object data and binary data | BINARY ![]() |
Table 2-89 Priorities of abstract data types
Data type of argument | Priority order |
---|---|
Abstract data type | Same data type ![]() |
Determine the function to be called when an abstract data type is included
Let A, B, and C denote abstract data types, where C is the super type of B and B is the super type of A (priority of abstract data types: A B
C).
CREATE TABLE T1(C1 C)
f(A), f(B), f(C)
SELECT f(C1) FROM T1
f(C)
f(A),f(B),f(C)
Actual value of T1.C1 | Function to be called |
---|---|
Type A | f(A) |
Type B | f(B) |
Type C | f(C) |
NULL value | f(C) |
CREATE TABLE T1(C1 C,C2 B)
f(A,A), f(A,B), f(A,C), f(B,A), f(B,C), f(C,A), f(C,B), f(C,C)
SELECT f(C1,C2) FROM T1
f(C,B)
f(A,A),f(A,B),f(A,C),f(B,A),f(B,C),f(C,A),f(C,B)
Actual value of T1.C1 | Actual value of T1.C2 | Function to be called |
---|---|---|
Type A | Type A | f(A,A) |
Type B | f(A,B) | |
NULL value | f(A,B) | |
Type B | Type A | f(B,A) |
Type B | f(B,C) | |
NULL value | f(B,C) | |
Type C | Type A | f(C,A) |
Type B | f(C,B) | |
NULL value | f(C,B) | |
NULL value | Type A | f(C,A) |
Type B | f(C,B) | |
NULL value | f(C,B) |