GET ROUTINE command
The GET ROUTINE command retrieves a routine SQL Archive (SAR) file for a specified SQL routine.
Authorization
EXECUTE privilege on SYSFUN.GET_ROUTINE_SAR procedure
Required connection
Database. If implicit connect is enabled, a connection to the default database is established.
Command syntax
Command parameters
- INTO file_name
- Names the file where routine SQL archive (SAR) is stored.
- FROM
- Indicates the start of the specification of the routine to be retrieved.
- SPECIFIC
- The specified routine name is given as a specific name.
- PROCEDURE
- The routine is an SQL procedure.
- routine_name
- The name of the procedure. If SPECIFIC is specified then it is the specific name of the procedure. If the name is not qualified with a schema name, the CURRENT SCHEMA is used as the schema name of the routine. The routine-name must be an existing procedure that is defined as an SQL procedure.
- HIDE BODY
- Specifies that the body of the routine must be replaced by an empty body when the routine text
is extracted from the catalogs.
This does not affect the compiled code; it only affects the text.
Examples
GET ROUTINE INTO procs/proc1.sar FROM PROCEDURE myappl.proc1;
Usage notes
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.