Database Reference
In-Depth Information
Figure 15.3
A Transaction Is
Set.
your DML command to fail rather than wait if another user is updating the
same row you try to update. Another common use is assigning large trans-
actions to very large rollback segments. Figure 15.2 shows the syntax of the
SET TRANSACTION command
Let's query an ARTIST row and start a read-only transaction using the
following commands. SQL*Plus Worksheet displays “Transaction set.” in
the lower pane. The result is shown in Figure 15.3.
SELECT ARTIST_ID, NAME, ZIP FROM ARTIST
WHERE NAME = 'Puddle of Mudd';
SET TRANSACTION READ ONLY;
Now let's try to change the zip code using the following script.
UPDATE ARTIST SET ZIP='10099'
WHERE NAME = 'Puddle of Mudd';
Figure 15.4 shows an error message. No changes can be made to the
database inside a read-only transaction. In addition, a read-only transaction
does not see changes to the database made by other users after the transac-
tion starts. This might be useful when you are generating a set of reports
that summarize data and must be consistent from beginning to end. For
Search WWH ::




Custom Search