Retrieves a routine SQL Archive (SAR) file for a specified SQL routine.
EXECUTE privilege on SYSFUN.GET_ROUTINE_SAR procedure
Database. If implicit connect is enabled, a connection to the default database is established.
>>-GET ROUTINE--INTO--file_name--FROM--+----------+-------------> '-SPECIFIC-' >----PROCEDURE----routine_name--+-----------+------------------>< '-HIDE BODY-'
This does not affect the compiled code; it only affects the text.
GET ROUTINE INTO procs/proc1.sar FROM PROCEDURE myappl.proc1;
If a GET ROUTINE or a PUT ROUTINE operation (or their corresponding procedure) fails to execute successfully, it will always return an error (SQLSTATE 38000), along with diagnostic text providing information about the cause of the failure. For example, if the procedure name provided to GET ROUTINE does not identify an SQL procedure, diagnostic "-204, 42704" text will be returned, where "-204" is SQLCODE and "42704" is SQLSTATE, that identify the cause of the problem. The SQLCODE and SQLSTATE in this example indicate that the procedure name provided in the GET ROUTINE command is undefined.
The GET ROUTINE command cannot archive routines whose specific name exceeds 18 characters in length. When you create an SQL routine with an explicit specific name, restrict the specific name to a maximum of 18 characters if you want to use the GET ROUTINE command.