Creating a native SQL procedure
A native SQL procedure is a procedure whose body is written entirely in SQL and is created by issuing a single SQL statement, CREATE PROCEDURE. Native SQL procedures typically perform better and have more functionality than external SQL procedures.
Before you begin
Before you create a native SQL procedure, Configure DB2® for running stored procedures and user-defined functions during installation or Configure DB2 for running stored procedures and user-defined functions during migration if the native SQL procedure satisfies at least one of the following conditions:
- The native SQL procedure calls at least one external stored procedure, external SQL procedure, or user-defined function.
- The native SQL procedure is defined with ALLOW DEBUG MODE or DISALLOW DEBUG MODE. If you specify DISABLE DEBUG MODE, you do not need to set up the stored procedure environment.
About this task
A native SQL procedure is a procedure whose body is written entirely in SQL. The body is written in the SQL procedural language. A native SQL procedure is created by issuing a single SQL statement, CREATE PROCEDURE. Native SQL procedures do not require any other program preparation, such as precompiling, compiling, or link-editing source code. Native SQL procedures are executed as SQL statements that are bound in a DB2 package. Native SQL procedures do not have an associated external application program.
Procedure
To create a native SQL procedure, perform one of the following actions: