8.4 Managing MLE Call Specifications

Functions exported by an MLE JavaScript module can be published by creating a call specification.

There are two types of call specifications: Module and Inlined (that is JavaScript code embedded in the DDL). Also, call specifications can be created as schema-level functions and procedures or they can be part of package declarations. Accordingly, the Navigator tab on the MLE JS page displays different icons to indicate a call specification in a package, module-based call specification and inlined call specification (with the blue overlay icon).

To create an inlined call specification, in the the Navigator tab, select Object submenu and click Inline Call Spec.

Creating a Call Specification for an MLE Module

To create a call specification for an MLE module:

  1. In the left pane, in the Navigator tab, select Object submenu and click Create Object.

    The Create MLE Call Spec panel appears.

  2. In the Name field, enter a name for the call specification.

  3. Select the module and environment in the Module Name and Environment Name fields.

    When the module is selected, the functions are automatically populated in the Available Functions box.

  4. Select Procedure or Function. If Function, select the return data type from the drop-down list.

  5. Select the function from the list of available functions. When you select the function, the parameters are automatically prefilled in the Parameters field. If needed, you can edit the Direction and Type fields. When you click the parameter row, the Parameter declaration and Signature fields are automatically prefilled.

  6. Click Create.

See Creating a Call Specification in the Oracle Database JavaScript Developer's Guide to know more about creating a call specification.

Context Menu Options

In the left pane, right-click the call specification object to view the following options:

  • Edit: Select to edit the call specification. You can only edit the parameter-related fields.
  • Drop: Select to remove the call specification from the database.
  • Compile: Select to compile or recompile the call specification.

See Example: Creating an MLE Call Specification for an example of how to create a call specification.

8.4.1 Example: Creating an MLE Call Specification

This example demonstrates how to create a call specification for the mod_imp_fact module created in Example: Creating an MLE Environment.
  1. In the MLE JS page, in the left pane, select Modules from the object type selector. From the list of modules displayed, select mod_imp_fact.
  2. Right-click and select Create, and then select Call Specification.
    The Create MLE Call Spec panel appears.
  3. In the Name field, enter factorialspec.
  4. In the Environment Schema and Enviornment Name fields, enter your currrent schema name and select myfactorialenv.
  5. Select Function, and then select VARCHAR2 from the dropdown list.
  6. In the Available Functions field, select the greetings function and the Signature field is automatically prefilled.
  7. Click Create.

    The Output pane displays the code for the call specification along with a function compiled notification.

  8. Run the function from the SQL Worksheet page and you see the following output:
    The factorial of 3 is: 6