SET SESSION

Use the SET SESSION command to set the characteristics of the current SQL session.

Syntax

Syntax for the SET SESSION command:
SET SESSION { READ ONLY | READ WRITE }

Inputs

The SET SESSION command takes the following inputs:
Table 1. SET SESSION inputs
Input Description
read only During the session, allows a user to read a database but not write to it. The system returns an error if the user attempts to write to the database. The user can create and write to temporary tables.
read write Allows a user to read and update a database. This is the default setting.

Outputs

The SET SESSION command has the following outputs:
Table 2. SET SESSION outputs
Output Description
SET VARIABLE The command was successful.
ERROR: Read-only session, cannot process this request The session is read only is specified and the user attempted to write to the database.

Privileges

No privileges are required to issue this command.

Usage

The following provides sample usage.
  • To set a session to read-only:
    MYDB.SCH1(USER)=> SET SESSION READ ONLY;