July 30, 2010, Friday, 210


Hide procedure body

From SQL PL Guide for DB2

Jump to: navigation, search

Hide the body of a SQL PL Stored Procedure

Sometimes it can be interessting to hide the code of a SQL PL stored procedure. This can be done with the PUT ROUTINE and GET ROUTINE command.

First you've to use the GET ROUTINE command with the HIDE BODY option to retrieve the routine into a SQL Archive File (SAR). The HIDE BODY option effects that just the compiled code will be stored in the SQL Archive not the text of the procedure. Afterwards with the PUT ROUTINE command the procedure can be imported on the target database.


Syntax:

 get routine into <filename> from [specific] procedure <procname> [hide body]; 
put routine from <filename> [owner <new-owner>];

Example:

 get routine into MYPROC.SAR from procedure DB2INST1.MYPROC hide body

 put routine from MYPROC.SAR 


Hint: Additional to these two commands in DB2 9.5 are the procedures GET_ROUTINE_SAR and PUT_ROUTINE_SAR available.



Link to the DB2 Information Center:
GET ROUTINE: DB2 9 DB2 9.5
PUT ROUTINE: DB2 9 DB2 9.5