Home | Previous Page | Next Page   Developing a User-Defined Routine > Registering a User-Defined Routine >

Creating an SPL Routine

For an SPL routine, the CREATE FUNCTION or CREATE PROCEDURE statement performs the following tasks:

For information on how to optimize an SPL routine, see Improving UDR Performance.

For a summary of the UDR information in the system catalog tables, refer to Reviewing Information about User-Defined Routines.

Figure 4 shows the parts of a CREATE FUNCTION statement that registers a user-defined function called abs_eq().

Figure 4. Registering an SPL Function
begin figure description - This figure is described in the surrounding text. - end figure description

When you create an SPL function, you can specify optional routine modifiers that affect how the database server executes the function. Procedures in SPL do not allow routine modifiers. Use the WITH clause of the CREATE FUNCTION statement to list function modifiers. SPL functions allow the following routine modifiers:

In Figure 4, the NOT VARIANT modifier indicates that the abs_eq() SPL function is written so that it always returns the same value when passed the same arguments.

You can use INOUT parameters in SPL routines as shown in the following syntax:

    CREATE PROCEDURE spl_proc ([IN|OUT|INOUT] arg0 DataType, ..., 
[IN|OUT|INOUT] argN  DataType);
    .........
    END PROCEDURE;

For more information about the CREATE FUNCTION and CREATE PROCEDURE statements and about the syntax of SPL, refer to the IBM Informix: Guide to SQL Syntax. For information about creating using SPL routines, refer to the IBM Informix: Guide to SQL Tutorial.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]