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: cancel an insert within the trigger?

Re: cancel an insert within the trigger?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 22 Sep 2004 21:54:55 +0800
Message-ID: <4151842F.6C1B@yahoo.com>


Andre wrote:
>
> Hello all,
>
> I have created an insert trigger:
> If I do a count on the table and this count results in a 1 or higher I
> would not insert the record. (of_id is not the primary key)
>
> CREATE OR REPLACE TRIGGER iu_cli BEFORE insert or update on client
> FOR EACH ROW
> BEGIN
> CC number;
> IF INSERTING
> THEN
> select count(*) into CC from client WHERE of_id = :new.of_id;
> If CC > 1 then
> --do not insert?
> ????????????
> end if;
> END IF;
> END;
> /
>
> The Question is: Can I do this this way?
> What code to put on the ???? marks?
>
> Thanks All,
> Anneke

You can't do the trigger this way...it won't work on a multi-user system

hth
connor

-- 
Connor McDonald
Co-author: "Mastering Oracle PL/SQL - Practical Solutions"
ISBN: 1590592174

web: http://www.oracledba.co.uk
web: http://www.oaktable.net
email: connor_mcdonald_at_yahoo.com

Coming Soon! "Oracle Insight - Tales of the OakTable"

"GIVE a man a fish and he will eat for a day. But TEACH him how to fish,
and...he will sit in a boat and drink beer all day"

------------------------------------------------------------
Received on Wed Sep 22 2004 - 08:54:55 CDT

Original text of this message

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