July 30, 2010, Friday, 210


SPECIFIC

From SQL PL Guide for DB2

Jump to: navigation, search

SPECIFIC

In DB2 you can create multiple stored procedures with the same name, but with different number of parameters. To handle this stored procedures (e.g. drop a stored procedure) you can specify a specific name for each of this procedure.

The specific name is limited to 18 characters. If you don't specify a specific name at creation time, DB2 will automatically create an specific name in the following format: SQL<timestamp> (e.g. SQL080105100942500).

Example:

 CREATE PROCEDURE myproc (IN var01 INTEGER)
  SPECIFIC myproc_with_1_par
 BEGIN
   ... statements ...
 END

 CREATE PROCEDURE myproc (IN var01 INTEGER, IN var02 INTEGER)
  SPECIFIC myproc_with_2_par
 BEGIN
   ... statements ...
 END

 DROP SPECIFIC PROCEDURE myproc_with_1_par

If you try to drop just the procedure MYPROC, you will get an error message (SQL0476).



Link to the DB2 Information Center: DB2 9 DB2 9.5