CREATE PROCEDURE

The CREATE PROCEDURE statement creates a stored procedure on the system. You can create the following:

For more information about procedures, see Stored Procedures in the SQL Programming topic in the Information CenterLink to Information center.

CREATE PROCEDURE (External)

An external procedure can be written in one of the following languages:

Example:

Create an external procedure PROC1. When the procedure is called using the CALL statement, a COBOL program named PGM1 in library LIB1 will be called.

CREATE PROCEDURE PROC1
      (CHAR(10), CHAR (10))
      EXTERNAL NAME LIB1.PGM1
      LANGUAGE COBOL GENERAL

For more information, see CREATE PROCEDURE (EXTERNAL) or SQL control statements in the SQL Reference topic in the Information CenterLink to Information center.

CREATE PROCEDURE (SQL)

The CREATE PROCEDURE (SQL) statement creates an SQL procedure.

Example:

Create a definition for an SQL procedure. The procedure accepts an employee number and a multiplier for a pay raise as input. The following tasks are performed in the procedure body:

CREATE PROCEDURE UPDATE_SALARY_1
    (IN EMPLOYEE_NUMBER CHAR(10),
    IN RATE DECIMAL(6,2)) 
  LANGUAGE SQL
  MODIFIES SQL DATA
  UPDATE EMP 
    SET SALARY = SALARY + RATE 
    WHERE EMPNO = EMPLOYEE_NUMBER

For more information, see CREATE PROCEDURE (SQL) or SQL control statements in the SQL Reference topic in the Information CenterLink to Information center.