INVOKE in the Out-list of a SELECT Statement |
You can use INVOKE as an expression in the out-list of a SELECT statement. This makes it possible to use a single statement to retrieve values from a database table and from a component. The syntax is: SELECT col1, (INVOKE MyComp.MyMethod1), (INVOKE MyComp.MyMethod2 WITH SELECT col2, col3) FROM Employee This syntax is the same syntax that is used by many database vendors for supporting subqueries in the out-list. The INVOKE in the out-list can be used in combination with ORDER BY/GROUP BY and HAVING. INVOKE cannot return more than one record. So when a query protocol is being invoked, only 0 or 1 records can be returned. If the INVOKE returns more records an error will occur and the statement will fail. By default, an INVOKE returns a string with maximum size of 32K. You can use the TO_CLOB() SQL function to tell the INVOKE to return the long string correctly without it being truncated. |