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: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 20 Jan 2004 20:11:28 +0800
Message-ID: <400D1AF0.4859@yahoo.com>


Christian "Raistlin" Gulich wrote:
>
> Hi,
> I have some multimedia content in my database stored using interMedia.
> Because there is no way, to declare these objects (ORDImage, ORDVideo, ...)
> as unique (or is it possible?), I wanted to write a trigger, wich ensures
> this constraints.
> The trigger fires before insert and update operations for each row.
> In this trigger a have to check, if the same object is already in the table.
> Therefore I must read the complete table and perform my checks. The problem
> is, that this tricker throws an error, that "table is modified at the moment
> an the trigger can't see this". Oracle suggestion to solve this, is not to
> read this table in the trigger - not very good for me. I suppose there is a
> lock at the table. Do you have any suggestions, how I could implement the
> trigger?
> Thanks 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 Tue Jan 20 2004 - 06:11:28 CST

Original text of this message

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