Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> cancel an insert within the trigger?
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;
The Question is: Can I do this this way? What code to put on the ???? marks?
Thanks All,
Anneke
Received on Tue Sep 21 2004 - 05:19:00 CDT