Home | Previous Page | Next Page   DataBlade Module Concepts > DataBlade Module Components >

Routines

A routine is a stored collection of programming statements that allows you to manipulate data.

A routine can be a function, which returns values, or a procedure, which does not. You can write routines in the Informix Stored Procedure Language (SPL), or in an external language, such as C or Java.

Important:
Not all routine options are available for SPL and Java. For more information, see the IBM Informix: DataBlade Developer's Kit User's Guide.

Routine overloading, or polymorphism, refers to writing a routine that performs the same task and has the same name as an existing routine—but one that takes a different data type as an argument. When you create opaque, collection, or row types, you can overload existing routines for your new data type. When the overloaded routine is called, your Informix database server determines which variant of the routine to use by examining the argument. BladeSmith creates a template for the overloaded routine; however, you must complete the code to enable the routine to complete the assigned task.

You can overload built-in and operator functions for all data types except built-in data types. You can create user-defined routines for all categories of data types. You can create support routines for all extended data types. You must create support routines for opaque data types (see Opaque Data Type Support Routines).

Built-in Functions and Operator Functions

Built-in functions perform arithmetic and other basic operations when included in SQL statements. Operator functions are built-in functions that are bound to operator symbols: for example, the plus() function is bound to the + operator. Some of the arithmetic functions take a single argument, such as the root() function, which calculates the square root of its argument; others take two arguments, such as the pow() function, which raises one argument to the power of the second.

When you overload a built-in or operator function, you must specify what the function does and what it returns. For example, if you overload the plus() function on a row type, you can choose to:

There are also built-in functions that do not take arguments and that you cannot overload, such as the today() function, which returns the current date and time.

For more information, see the IBM Informix: User-Defined Routines and Data Types Developer's Guide.

User-Defined Routines

Typically, user-defined routines perform operations specific to the data or application for which they are created and are not based on routines provided with your Informix database server. End users call user-defined routines within SQL statements or through the DataBlade API. BladeSmith has a wizard to help you define the parameters for user-defined routines.

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