External Routine Reference

Include the External Routine Reference clause when you write an external routine. This option is not available for SPL routines.

Syntax

(1)
External Routine Reference

1  EXTERNAL NAME  %Shared-Object Filename1  LANGUAGE
1 C
1 JAVA
2?  PARAMETER STYLE!  INFORMIX
2? 23
3.1! VARIANT
3.1 NOT VARIANT
Notes:

Usage

If the IFX_EXTEND_ROLE configuration parameter is set to ON or to 1, authorization to use this segment is available only to the Database Server Administrator (DBSA), and to users whom the DBSA has granted the EXTEND role. By default, the DBSA is user informix. In addition, you cannot create an external routine unless you hold the Resource or DBA privilege on the database, and also hold the Usage privilege on the external programming language in which the routine is written. For the syntax of the GRANT USAGE ON LANGUAGE C and GRANT USAGE ON LANGUAGE JAVA statements of SQL, see Language-Level Privileges.

This segment specifies the following information about an external routine:
  • Pathname to the executable object code, stored in a shared-object file

    For C routines, this file is either a DLL or a shared library, depending on your operating system.

    For Java routines, this file is a jar file. Before you can create a UDR written in the Java language, you must assign a jar identifier to the external jar file with the sqlj.install_jar procedure. For more information, see sqlj.install_jar.

  • The name of the programming language in which the UDR is written
  • The parameter style of the UDR

    By default, the parameter style is INFORMIX. (This implies that if you specify OUT or INOUT parameters, the OUT or INOUT values are passed by reference.)

  • The VARIANT or NOT VARIANT option. If you specify neither, the default is VARIANT. If the routine includes any statement of SQL it is a VARIANT routine. If a DDL statement that includes the External Routine Reference clause also includes the Routine Modifier clause, do not classify the same UDR as VARIANT in one of these clauses and as NOT VARIANT in the other.

Example

The following example includes an external routine reference for a Java language UDR. You must first register demo_jarusing the procedure install_jar(<absolute path><jar file name>,<internal registered name>).
CREATE FUNCTION delete_order(int) RETURNING int
   EXTERNAL NAME 'informix.demo_jar:delete_order.delete_order()'
   LANGUAGE JAVA;