snippetjournal

– notes, snippet codes, and my journal

Posts Tagged ‘oracle

[Oracle] ORA-02292 : Mencari Table Constraints dengan Constraints Name

leave a comment »

mencoba mengupdate salah satu column pada row, tetapi terkena error seperti ini :

update auth_users set username = ‘user1@test.co.id’ where name = ‘user@test.co.id’
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
dependency.
*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’;

Advertisements

Written by snippetjournal

January 4, 2016 at 10:26 am

Posted in Programming

Tagged with ,

“pessimistic locking” and “optimistic locking.”

leave a comment »

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.

http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/TransactionJTA_Overview-Pessimistic_and_optimistic_locking.html

Written by snippetjournal

September 29, 2012 at 2:02 pm