Execute a UDR
- In a client application or SPL routine, through SQL statements:
- In the select list of a SELECT statement
- In the WHERE clause of a SELECT, UPDATE, or DELETE statement
- In the VALUES clause of an INSERT statement
- In the SET clause of an UPDATE statement
- With the EXECUTE PROCEDURE or EXECUTE FUNCTION statement
- In a C UDR, as an SQL statement that one of the following DataBlade®
API statement-execution
functions sends to the database server:
- mi_exec()
- mi_exec_prepared_statement()
- mi_open_prepared_statement()
For more information about how to use statement-execution functions, see Execute SQL statements.
- Through an implicit UDR call 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; - Through the Fastpath interface
The Fastpath interface of the DataBlade® API allows you to call a UDR directly from within another UDR. For more information, see Call UDRs with the Fastpath interface.
SELECT a_func(x) FROM table1 WHERE y > 7;Similarly an iterator function might contain many invocations in a single routine instance.
- The query parser breaks the SQL statement into its syntactic parts
and performs any routine resolution required.
The query optimizer develops a query plan, which efficiently organizes the execution of the SQL-statement parts.
- The query executer calls the routine manager, which handles execution of the UDR instance and any invocations.
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 section about how a UDR runs in the HCL® Informix® User-Defined Routines and Data Types Developer's Guide.