I wondered if there is anyway to avoid corruption of data in READ COMMITTED isolation level.
Here is a sample of my issue: two sessions working with the same tables.
SSN1> ALTER TABLE APPLICANT ADD( AVGSLEVEL2 NUMBER(5,2) )
Meanwhile in another session....
SSN2> INSERT INTO SPossessed VALUES ( 000001, 'TRUCK DRIVING', 9 );
Back in the first session ...
SSN1> UPDATE APPLICANT
2 SET AVGSLEVEL = ( ( SELECT SUM(SKILLLEVEL)
3 FROM SPOSSESSED
4 WHERE A# = APPLICANT.A# ) /
5 ( SELECT COUNT(*)
6 FROM SPOSSESSED
7 WHERE A# = APPLICANT.A#) );
Then second session does ...
SSQN2> select AVGSLEVEL from APPLICANT;
But when first session issues a commit ...
SSN1> COMMIT;
... then what does second session get?
SSN2> select AVGSLEVEL from APPLICANT;
SSN2> COMMIT;
how to improve first session SQL script included such that it can be safely processed at READ COMMITTED isolation level?