After you register a UDR as an external routine in the database, it can be called in one of the following ways:
For more information on how to use statement-execution functions, see Executing SQL Statements.
An implicit UDR is a UDR that the database server calls automatically in response to some SQL task. For example, in the following SELECT statement, the database server calls the a_to_int( ) cast function when it executes the SELECT statement:
CREATE IMPLICIT CAST (a AS INTEGER WITH a_to_int); ... SELECT a:int FROM tab1 WHERE b > 6;
The Fastpath interface of the DataBlade API allows you to call a UDR directly from within another UDR. For more information, see Calling UDRs with the Fastpath Interface.
Each occurrence of a UDR, implicit or explicit, in an SQL or SPL statement is a routine instance. One routine instance might involve several routine invocations. A routine invocation is one execution of the UDR. For example, if the following query selects five matching rows, the query has one routine instance of the a_func( ) user-defined function and five routine invocations for this function:
SELECT a_func(x) FROM table1 WHERE y > 7;
Similarly an iterator function might contain many invocations in a single routine instance.
To execute a UDR instance in an SQL statement, the database server takes the following steps:
The query optimizer develops a query plan, which efficiently organizes the execution of the SQL-statement parts.
The following sections provide information about how the steps of UDR execution can affect the way that you write the UDR. For more general information, see the chapter on how a UDR runs in the IBM Informix: User-Defined Routines and Data Types Developer's Guide.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]