Alternative Syntax for Calling Components

Previous Next

See Also

There is an alternative, simplified, syntax that can be used to call components in some cases. The syntax is:

SELECT Component1.Method1(), Component2.Method2(col1, col2)

FROM t1

This alternative syntax is equivalent to:

SELECT (INVOKE Component1.Method1), (INVOKE Component2.Method2 WITH SELECT col1, col2)

FROM t1

There are a number of restrictions that you should be aware of when considering the use of this alternative syntax:

· INVOKE in the outlist of a SELECT statement allows only methods/query protocols that have exactly one output value.

 

· If a query protocol is used, it must return 0 or 1 row. If multiple rows are returned when a query protocol is used, an error will occur. If zero rows are returned, a NULL will be used as the result value.

 

· The alternative syntax cannot be used in expressions, for example, the following are not permitted:

SELECT col1 + Component1.Method1()

or

SELECT upper(Component1.Method2())

· You can use the alternative syntax in a WHERE clause, but with the above restrictions. For example:

SELECT * from t1

WHERE col1 < Component1.Method1(col2)