Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger to ensure unique objects

Re: Trigger to ensure unique objects

From: Karsten Schmidt <groups_at_karsten-schmidt.com>
Date: 21 Jan 2004 00:20:32 -0800
Message-ID: <c6711ac4.0401210020.5b749b6c@posting.google.com>


Hi,
 your trigger will not be able to see uncommitted changes made by another session. No way around that. All you need to break uniqueness is two concurrent inserts. The only way to do this kind of thing within a trigger is to take an exclusive lock on the entire table, thus making insert/update a single-user operation.

 As Connor said, it is far better to use unique constraints. (i.e. allows concurrent modification.) You might be able to use a trigger to pull the 'unique' information out of the image and store it in a regular column with an unique constraint, or create a unique function-based index.

Karsten

"Christian \"Raistlin\" Gulich" <Christian.Gulich_at_IN.Stud.TU-Ilmenau.de> wrote in message news:<bujikt$rs5$1_at_piggy.rz.tu-ilmenau.de>...
> Hi,
> 'uniqueness' is determined by some attributes extracted from an image, not
> only the filename or an other simple attribute. But I found a solution in
> using "instead of"-triggers. There aren't any locks, wich disturb my
> trigger.
> Christian
>
> >
> > What determines 'uniqueness' here though?
> >
> > eg If you open a word document, change a letter and change it back, then
> > save it, the binary result is not the same as the original document.
> > Various attributes (file name, modified, size, etc) might be candidates
> > for uniqueness but these could be done as separate scalar datatypes and
> > thus the standard uniqueness constraints used.
> >
> > hth
> > connor
> > --
> > -------------------------------
> > Connor McDonald
> > http://www.oracledba.co.uk
> > Co-Author: "Mastering Oracle PL/SQL - Practical Solutions"
> >
Received on Wed Jan 21 2004 - 02:20:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US