SQL$HELP_OLD72.HLB  —  CALL  Compound Statement, Examples
    Example 1: Calling an external routine within a compound
    statement

    BEGIN
       DECLARE :param1 INTEGER;
       CALL extern_routine (:param1, 3);
    END;

    Example 2: Calling a stored procedure from a stored function

    SQL> CREATE MODULE utility_functions
    cont>   LANGUAGE SQL
    cont> --
    cont>   PROCEDURE trace_date (:dt DATE);
    cont>      BEGIN
    cont>         TRACE :dt;
    cont>      END;
    cont> --
    cont>   FUNCTION mdy (IN :dt DATE) RETURNS CHAR(10)
    cont>   COMMENT 'Returns the date in month/day/year format';
    cont>      BEGIN
    cont>         IF :dt IS NULL THEN
    cont>            RETURN '**/**/****';
    cont>         ELSE
    cont>            CALL trace_date (:dt);
    cont>            RETURN CAST(EXTRACT(MONTH FROM :dt) AS VARCHAR(2)) || '/' ||
    cont>                   CAST(EXTRACT(DAY FROM :dt) AS VARCHAR(2)) || '/' ||
    cont>                   CAST(EXTRACT(YEAR FROM :dt) AS VARCHAR(4));
    cont>         END IF;
    cont>      END;
    cont> END MODULE;
Close Help