0

I am developing an application in DB2 with SQL PL, and the routines (procedures and functions) are being defined in a module.

However, each time I change a routine, I cannot replace it, and I have to drop the module body, and recreated.

Is there any way to do a REPLACE for a routine inside a module?

AngocA
  • 7,655
  • 6
  • 39
  • 55
  • So `CREATE OR REPLACE PROCEDURE...` doesn't work in a module? – dan1111 Oct 15 '12 at 08:40
  • No, it does not work, because the command is ALTER MODULE XXX ADD PROCEDURE YYYY. I am looking for something like ALTER MODULE XXX REPLACE PROCEDURE YYYY, but it does not exist. – AngocA Oct 16 '12 at 04:20

1 Answers1

0

In order to replace a routine (stored procedure or function) in a module, it is not necessary to drop the body and recreate all objects.

In order to replace a routine, it is possible to drop a specific procedure/function, and just recreate it:

ALTER MODULE m1 ADD PROCEDURE p1 ()
 BEGIN
  ...
 END@
ALTER MODULE m1 DROP PROCEDURE p1@
ALTER MODULE m1 ADD PROCEDURE p1 ()
 BEGIN
  ...
 END@

However, there is not a real REPLACE operation.

AngocA
  • 7,655
  • 6
  • 39
  • 55