Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements >

CREATE ROUTINE FROM

Use the CREATE ROUTINE FROM statement to register a UDR by referencing the text of a CREATE FUNCTION or CREATE PROCEDURE statement that resides in a separate file. Only Dynamic Server supports this statement, which is an extension to the ANSI/ISO standard for SQL. You can use this statement with ESQL/C.

Syntax

Read syntax diagramSkip visual syntax diagram>>-CREATE ROUTINE FROM--+-'file'---+---------------------------><
                        '-file_var-'
 
Element Description Restrictions Syntax
file Pathname and filename for the text of a CREATE PROCEDURE or CREATE FUNCTION statement. Default path is the current directory. Must exist and can contain only one CREATE FUNCTION or CREATE PROCEDURE statement. Operating-system dependent
file_var Name of a program variable that contains file specification Must be a character data type; contents must satisfy file restrictions Language specific

Usage

ESQL/C programs cannot use the CREATE FUNCTION or CREATE PROCEDURE statement directly to define a UDR. You must instead do this:

  1. Create a source file with the CREATE FUNCTION or CREATE PROCEDURE statement.
  2. Execute the CREATE ROUTINE FROM statement from an ESQL/C program to send the contents of this source file to the database server for execution. The file that you specify can contain only one CREATE FUNCTION or CREATE PROCEDURE statement.

The file specification that you provide is relative. If you include no pathname, 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. If you know whether the UDR is a function or a procedure, you can improve the readability of your code by using the matching SQL statement to access the source file:

When the IFX_EXTEND_ROLE configuration parameter is set to ON, only users to whom the Database System Administrator (DBSA) has granted the built-in EXTEND role can create external routines.

Routines use the collating order that was in effect when they were created. See SET COLLATION for information about using non-default collation.

Related Information

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

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]