INFORMIX
Informix Guide to SQL: Tutorial
Chapter 14: Creating and Using SPL Routines
Home Contents Index Master Index New Book

Finding Errors in an SPL Routine

When you use CREATE PROCEDURE or CREATE FUNCTION to write an SPL routine, the statement fails when you select Run from the menu, if a syntax error occurs in the body of the routine.

If you are creating the routine in DB-Access, when you choose the Modify option from the menu, the cursor moves to the line that contains the syntax error. You can select Run and Modify again to check subsequent lines.

Looking at Compile-Time Warnings

If the database server detects a potential problem, but the syntax of the SPL routine is correct, the database server generates a warning and places it in a listing file. You can examine this file to check for potential problems before you execute the routine.

The filename and pathname of the listing file are specified in the WITH LISTING IN clause of the CREATE PROCEDURE or CREATE FUNCTION statements. For information about how to specify the pathname of the listing file, see "Specifying a Document Clause".

If you are working on a network, the listing file is created on the system where the database resides. If you provide an absolute pathname and filename for the file, the file is created at the location you specify. If you provide a relative pathname for the listing file, the file is created in your home directory on the computer where the database resides. If you do not have a home directory, the file is created in the root directory.

After you create the routine, you can view the file that is specified in the WITH LISTING IN clause to see the warnings that it contains.

Generating the Text of the Routine

Once you create an SPL routine, it is stored in the sysprocbody system catalog table. The sysprocbody table contains the executable routine, as well as its text.

To retrieve the text of the routine, select the data column from the sysprocbody system catalog table. The datakey column for a text entry has the code T.

The SELECT statement in Figure 14-105 reads the text of the SPL routine read_address.

Figure 14-105




Informix Guide to SQL: Tutorial, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.