Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Manage Transaction Isolation Level
How To Manage Transaction Isolation Level? - Oracle DBA FAQ - Introduction to PL/SQL
✍: FYIcenter.com
Transaction isolation level can be managed in a procedure by using the SET TRANSACTION and COMMIT statements. Here is a sample script on how to manage transaction isolation level:
SQL> CREATE OR REPLACE PROCEDURE HR.TOTAL_SALARY AS
2 total_salary NUMBER(12,2);
3 BEGIN
4 SET TRANSACTION READ ONLY;
5 SELECT SUM (salary) INTO total_salary FROM employees;
6 DBMS_OUTPUT.PUT_LINE('Total salary 1: '
7 || total_salary);
8 -- Other sessions may change salaries of some records
9 SELECT SUM (salary) INTO total_salary FROM employees;
10 DBMS_OUTPUT.PUT_LINE('Total salary 2: '
11 || total_salary);
12 COMMIT;
13 END;
14 /
SQL> EXECUTE TOTAL_SALARY;
Total salary 1: 691400
Total salary 2: 691400
"READ ONLY" transaction level takes a read only snapshot of the database. This allows other sessions to update the database without any locks. All queries in the session will produces identical results. So both SELECT statements in this script will return the same value guaranteed.
2007-04-26, 7405👍, 0💬
Popular Posts:
How can you enable automatic paging in DataGrid ? Following are the points to be done in order to en...
Is There Any XSD File to Validate Atom Feed Files? - RSS FAQs - Atom Feed Introduction and File Gene...
If we have multiple AFTER Triggers on table how can we define the sequence of the triggers ? If a ta...
What are the high-level thread states? The high-level thread states are ready, running, waiting, and...
How To Increment Dates by 1? - Oracle DBA FAQ - Understanding SQL Basics If you have a date, and you...