informix
Informix Guide to SQL: Syntax
SQL Statements

CREATE ROUTINE FROM

Use the CREATE ROUTINE FROM statement to access a user-defined routine (UDR). The actual text of the CREATE FUNCTION or CREATE PROCEDURE statement resides in a separate file.

Syntax

Element Purpose Restrictions Syntax
file Pathname and filename of the file that contains the full text of a CREATE PROCEDURE or CREATE FUNCTION statement The default pathname is the current directory. The specified file must exist. The file that you specify can contain only one CREATE FUNCTION or CREATE PROCEDURE statement. Pathname and filename must conform to the conventions of your operating system.
file_var Name of a program variable that holds the value of file The file that is specified in the program variable must exist. The file that you specify can contain only one CREATE FUNCTION or CREATE PROCEDURE statement. Name must conform to language-specific rules for variable names.

Usage

An Informix ESQL/C program cannot directly define a UDR. That is, it cannot contain the CREATE FUNCTION or CREATE PROCEDURE statement. The following steps describe how you can use a UDR in an ESQL/C program:

  1. Create a source file with the CREATE FUNCTION or CREATE PROCEDURE statement.
  2. Use the CREATE ROUTINE FROM statement to send the contents of this source file to the database server for execution.
  3. The file that you specify in the file parameter can contain only one CREATE FUNCTION or CREATE PROCEDURE statement.

The filename that you provide is relative. If you provide a simple filename, the client application looks for the file in the current directory.

If you do not know at compile time whether the UDR in the file is a function or a procedure, use the CREATE ROUTINE FROM statement in the ESQL/C program. However, if you do know if the UDR is a function or procedure, Informix recommends that you use the matching statement to access the source file:

Use of the matching statements improves the readability of the code.

Related Information

Related statements: CREATE FUNCTION, CREATE FUNCTION FROM, CREATE PROCEDURE, and CREATE PROCEDURE FROM


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved