Basic Oracle Concepts and Programming Question:

How To Set a Transaction To Be READ ONLY in Oracle?

Tweet Share WhatsApp

Answer:

If you want a transaction to be set as READ ONLY, you need to the transaction with the SET TRANSACTION READ ONLY statement. Note that a DML statement will start the transaction automatically. So you have to issue the SET TRANSACTION statement before any DML statements. The tutorial exercise below shows you a good example of READ ONLY transaction:

SQL> connect HR/globalguideline

SQL> SET TRANSACTION READ ONLY;
Transaction set.

SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06
112 oracle.com 07-MAY-06
113 sql.com 07-MAY-06</pre>

Download Oracle Database PDF Read All 430 Oracle Database Questions
Previous QuestionNext Question
What Is a READ ONLY Transaction in Oracle?What Are the Restrictions in a Oracle READ ONLY Transaction?