Posts Tagged ‘oracle’
mencoba mengupdate salah satu column pada row, tetapi terkena error seperti ini :
update auth_users set username = ‘firstname.lastname@example.org’ where name = ‘email@example.com’
Error report –
SQL Error: ORA-02292: integrity constraint (ADMIN.FK_2TUB76GCBJC6VCSO1FBE15L3P) violated – child record found
02292. 00000 – “integrity constraint (%s.%s) violated – child record found”
*Cause: attempted to delete a parent key value that had a foreign
*Action: delete dependencies first then parent or disable constraint.
maka kita dapat mencari tahu, constraints name itu milik table siapa (FK_2TUB76GCBJC6VCSO1FBE15L3P). gunakan syntax berikut :
select table_name from user_constraints where constraint_name=’FK_2TUB76GCBJC6VCSO1FBE15L3P’;
Pessimistic Locking :
Pessimistic locking is when a transaction occurs, and then the resource is locked from the time it is first accessed. Until the transaction finished another transaction cant accessed the resources.
Optimistic Locking :
Optimistic locking applied a fail safe way. The state of resource is locked as soon the transaction occurs. But when another transaction occurs and attempting to accessed the resource it will result a delayed. Until the first accessed resources finished and unlock the resources.
The lock exists until the transaction committed or rolled back. If the resource is released. It will be compare the state which has been changed to the state when the time its locked. If the state differ it will rolled back the resource.
It compare the state of resource instead compare the changed data.
Some article defined a state as a version.