Invokes an external or stored procedure from within a compound statement. That is, invocation must occur with a BEGIN . . . END block. The OUT and INOUT arguments cannot be general value expressions. They must be variables or parameters. The IN argument can be a general value expression. When you register a procedure definition with the CREATE PROCEDURE statement, you store information in the database about an external procedure written in a 3GL language. External procedures reside outside the database. The CREATE PROCEDURE statement is documented under the CREATE Routine. See the CREATE Routine for more information on creating external procedures. For optional information on invoking stored procedures, see the CALL Simple_Statement.
1 – Environment
You can use the compound statement CALL: o In interactive SQL o Embedded in host language programs to be precompiled o As part of a procedure in an SQL module o In dynamic SQL as a statement to be dynamically executed
2 – Format
(B)0[m[1;4mCALL[m[1m qq> <procedure-name> qq> ( qwqqqqqqqqqqqqqqqqqqqwq> ) qq> [m [1m mqwq> value-expr qwqj [m [1mtq>[m [1mDEFAULT qqqqu[m [1m mqqqqqq , <qqqqqj [m
3 – Arguments
3.1 – DEFAULT
Requests that Oracle Rdb use the DEFAULT expression defined for the parameter. The DEFAULT can be defined for an IN parameter during the CREATE MODULE . . . PROCEDURE or ALTER MODULE . . . ADD PROCEDURE statements. If no DEFAULT clause exists then the NULL expression is assumed.
3.2 – procedure-name
The name of the external or stored procedure being invoked.
3.3 – value-expr
Any value expression except DBKEY or aggregate functions. See the Value_Expressions HELP topic for details on value expressions.
4 – 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;