Contents Index SET SQLCA statement [ESQL] SIGNAL statement

ASA SQL Reference
  SQL Statements

SETUSER statement


Description 

Use this statement to allow a database administrator to impersonate another user, and to enable connection pooling.

Syntax 

SET SESSION AUTHORIZATION | SETUSER }
[ [ WITH OPTIONS ] userid ]

Parameters 

WITH OPTIONS    By default, only permissions (including group membership) are altered. If WITH OPTIONS is specified, the database options in effect are changed to the current database options of userid.

Usage 

The SETUSER statement is provided to make database administration easier. It enables a user with DBA authority to impersonate another user of the database.

SETUSER can also be used from an application server to take advantage of connection pooling. Connection pooling cuts down the number of distinct connections that need to be made, which can improve performance.

SETUSER with no user ID undoes all earlier SETUSER statements.

The SETUSER statement cannot be used inside a procedure, trigger, event handler or batch.

There are several uses for the SETUSER statement, including the following:

Permissions 

Must have DBA authority.

See also 

EXECUTE IMMEDIATE statement [SP]

GRANT statement

REVOKE statement

SET OPTION statement

Standards and compatibility 
Example 

The following statements, executed by a user named DBA, change the user ID to be Joe, then Jane, and then back to DBA.

SETUSER 'Joe'
// ... operations...
SETUSER WITH OPTIONS 'Jane'
// ... operations...
SETUSER

Contents Index SET SQLCA statement [ESQL] SIGNAL statement