9.3. The SET TRANSACTION Statement
The SET TRANSACTION statement may be used to explicitly begin a transaction. Using it, you can change the transaction isolation level from its default.
|
The syntax for a SQLJ executable statement containing the SET TRANSACTION statement is:
#sql { SET TRANSACTION [ access_mode], [ISOLATION LEVEL transaction_isolation_level] };
The syntax elements are as follows:
access_mode
-
Specifies the access mode for the transaction, which indicates whether the transaction can only read data or can both read and write data. The access mode may be set to one of the following values:
READ ONLY
-
READ ONLY means that the transaction may contain only SELECT statements, and that the DML statements INSERT, UPDATE, DELETE, and SELECT FOR UPDATE are not allowed. The Oracle JDBC drivers do not support READ ONLY.
READ WRITE
-
This is the default access mode. READ WRITE means that all DML statements are allowed in the transaction.
transaction_isolation_level
-
Specifies the transaction isolation level to use for the transaction. The following values are valid:
SERIALIZABLE
-
Prohibits dirty reads, non-repeatable reads, and phantom reads.
READ COMMITTED
-
Prohibits dirty reads. Allows non-repeatable reads and phantom reads.
The following statement sets the transaction ...
Get Java Programming with Oracle SQLJ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.