CREATE MODULE

Creates a new module.

create_module.png

 

Usage

Embedded/Interactive/Module/ODBC/JDBC.

Description

If module-name is specified in its unqualified form, the module will be created in the schema which has the same name as the current ident.

If module-name is specified in its fully qualified form (i.e. schema-name.module-name) the module will be created in the named schema (in this case, the current ident must be the creator of the specified schema).

A module is simply a convenient enclosure for the collection of one or more routines that are declared as belonging to the module when it is created.

Language Elements

function-definition, see CREATE FUNCTION.

procedure-definition, see CREATE PROCEDURE.

Restrictions

Two modules with the same name cannot belong to the same schema.

All the functions and procedures declared as belonging to the module must be created in the same schema as the module.

Two functions with the same name can only belong to the same schema if they have different numbers of parameters, or the data types for the parameters differ. (See Mimer SQL Programmer's Manual, Parameter Overloading for more information.)

Similarly, two procedures with the same name can only belong to the same schema if they have different numbers of parameters, or the data types for the parameters differ.

It is not possible to create a synonym for a module name.

Notes

The names of the functions and procedures declared as belonging to the module are qualified by using the name of schema to which they belong and not the name of the module.

Example

@

CREATE MODULE M1

DECLARE PROCEDURE PROC_1()

READS SQL DATA

BEGIN

...

END;

 

DECLARE PROCEDURE PROC_2(IN X INTEGER)

MODIFIES SQL DATA

BEGIN

...

END;

 

DECLARE FUNCTION FUNC_1() RETURNS INTEGER

READS SQL DATA

BEGIN

...

END;

 

 

END MODULE

@

 

For more information, see the Mimer SQL User's Manual, Creating Functions, Procedures, Triggers and Modules.

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

Feature P001, “Stored modules”.