As an ISV, you might want to protect your intellectual capital of DB2 Stored Procedures that you created for your product. You might not want your end-users to see how you coded your DB2 stored procedures.

These are the steps that you have to take to hide the SQL PL Stored Procedure body.

  • On the source machine, you create your SP as usual. For example:

    CREATE PROCEDURE myshcema.myproc
    BEGIN
    INSERT into T values(1);
    DELETE from T2 WHERE c2 = 3;
    END
  • On the source machine, perform the following command.

    GET ROUTINE into myproc.sar FROM PROCEDURE myschema.myproc HIDE BODY

    This creates a “sar” file, which contains a packaged representation of the procedure and other catalog information.
  • On the target machine, you create the SP using this command:

    PUT ROUTINE FROM myproc.sar

    This will install the procedure, but what you will see in the catalogs is:

    CREATE PROCEDURE myshcema.myproc
    BEGIN
    END