DB2 Version 9.7 for Linux, UNIX, and Windows

PUT ROUTINE command

Uses the specified routine SQL Archive (SAR) file to define a routine in the database.

Authorization

dbadm. This authority must be granted directly to the user and not inherited via a role.

Required connection

Database. If implicit connect is enabled, a connection to the default database is established.

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-PUT ROUTINE--FROM--file-name--------------------------------->

>--+-------------------------------------+---------------------><
   '-OWNER--new-owner--+---------------+-'   
                       '-USE REGISTERS-'     

Command parameters

FROM file-name
Names the file where routine SQL archive (SAR) is stored.
OWNER new-owner
Specifies a new authorization name that will be used for authorization checking of the routine. The new owner must have the necessary privileges for the routine to be defined. If the OWNER clause is not specified, the authorization name that was originally defined for the routine is used.
USE REGISTERS
Indicates that the CURRENT SCHEMA and CURRENT PATH special registers are used to define the routine. If this clause is not specified, the settings for the default schema and SQL path are the settings used when the routine is defined. CURRENT SCHEMA is used as the schema name for unqualified object names in the routine definition (including the name of the routine) and CURRENT PATH is used to resolve unqualified routines and data types in the routine definition.

Examples

   PUT ROUTINE FROM procs/proc1.sar;

Usage notes

No more than one procedure can be concurrently installed under a given schema.

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" and "42704" are the SQLCODE and SQLSTATE, respectively, 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.