Monday, April 23, 2007

how to: prevent concurrent updates on Oracle 10 Database and up

some time ago I had to verify on an Oracle Database 10 that concurrent updates are not possible. The answare to fix this issue were very simple: just use a new functionlity of Oracle 10 (SQL Server support this since years): ORA_ROWSCN

here a small example:

CREATE OR REPLACE TRIGGER triggerName
BEFORE INSERT ON TableName
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
Begin
:NEW.ORA_ROWSCN := '1';
End triggerName;

Notice: in Oracle this is a hidden field.

No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge