Create the routine sequence

A routine sequence is the context in which the UDR executes. Generally, each routine instance (whether implicit or explicit) creates a single, independent routine sequence.

For example, suppose you have the following query:
SELECT a_func(x) FROM table1 WHERE a_func(y) > 7;

When this query executes in serial, it contains two routine instances of a_func(): one in the select list and the second in the WHERE clause. Therefore, this query has two routine sequences.

However, when a query with a parallelizable UDR (one that is registered with the PARALLELIZABLE routine modifier) executes in parallel, each routine instance might have more than one routine sequence. For more information, see Execute the parallelizable UDR.

For each routine sequence, the routine manager creates a routine-state space, called an MI_FPARAM structure, that contains routine-state information from the routine sequence, including the following information:
  • The routine identifier
  • The number of arguments passed to the UDR
  • Information about the UDR arguments
  • The user state (optional)

The MI_FPARAM structure does not contain the actual argument values.

The routine manager allocates an MI_FPARAM structure when it initializes the routine sequence. This structure persists across all routine invocations in that routine sequence because the MI_FPARAM structure has a memory duration of PER_COMMAND. The routine manager passes an MI_FPARAM structure as the last argument to a UDR. (For more information, see The MI_FPARAM argument.) To obtain routine-state information, a C UDR invocation can access its MI_FPARAM structure. (For more information, see Access MI_FPARAM routine-state information.)