1 SET_SESSION_AUTHORIZATION Allows you to transfer the current database attach to another user. 2 Environment You can use the SET SESSION AUTHORIZATION statement: o In interactive SQL o Embedded in host language programs to be precompiled o As part of a procedure in an SQL module o In dynamic SQL as a statement to be dynamically executed 2 Format SET SESSION AUTHORIZATION -+-> host-variable -------+--> +-> 'literal-user-auth' -+ literal-user-auth = ---> USER '' -+------------------------+--> +-> USING '' -+ 2 Arguments 3 host-variable Specifies the name of the user and the password to whom the database attach is being transferred as a string literal or a host variable. If a host-variable is specified, it must contain the literal-user-auth as a string literal. 3 USER_'username' A character string literal that specifies the operating system user name that the database system uses for privilege checking. 3 USING_'password' A character string literal that specifies the user's password for the user name specified in the USER clause. 2 Usage_Notes o You must have the SELECT privilege on the database to set session authorization. o The specified user and password (in the USING clause) must be a valid OpenVMS user authorization. o If the operation is successful, the SESSION_USER and SESSION_ UID will be changed to reflect the specified OpenVMS user. o No transaction can be active when the session authorization is modified by this statement. 2 Examples Example 1: Reusing the Current Database Attach for Another User SQL> ATTACH 'FILENAME db$:personnel'; SQL> SET SESSION AUTHORIZATION 'USER ''SMITH'' USING ''SECRET1'''; SQL> SHOW PRIV ON DATABASE RDB$DBHANDLE Privileges on Alias RDB$DBHANDLE (IDENTIFIER =[RDB,SMITH],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ ALTER+DROP+DBCTRL+OPERATOR+DBADM+REFERENCES+SECURITY+DISTRIBTRAN) SQL> SET SESSION AUTHORIZATION 'USER ''JAIN'' USING ''SECRET2'''; SQL> SHOW PRIV ON DATABASE RDB$DBHANDLE Privileges on Alias RDB$DBHANDLE (IDENTIFIER =[RDB,JAIN],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ ALTER+DROP+DBCTRL+OPERATOR+DBADM+REFERENCES+SECURITY+DISTRIBTRAN)