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 -> How do you use a trigger in Oracle to delete an unwanted insert?

How do you use a trigger in Oracle to delete an unwanted insert?

From: <jsenarat_at_my-deja.com>
Date: Tue, 21 Sep 1999 23:48:21 GMT
Message-ID: <7s95g1$6eq$1@nnrp1.deja.com>


How do you use a trigger in Oracle to delete an unwanted insert?

I'm trying not to let an application insert nulls to a table column/row, and would like to stop this via a trigger, without generating an Oracle error to the app. (i.e. The app would see it as a successful insert). This is a quick fix while the developer fixes his/her app and on the long run this should not happen. I cannot stop all inserts to this table as 95% of the entries written are good ones (without nulls)

Following is a quick trigger I came up with but gives me the "mutating error"

CREATE OR REPLACE TRIGGER T_CST_TRAN AFTER INSERT OR UPDATE OF SSN ON CST_TRAN
FOR EACH ROW BEGIN

	IF :new.SSN is NULL THEN
		delete from CST_TRAN where rowid=:new.rowid;
	END IF;

END; Appreciate your help!

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Sep 21 1999 - 18:48:21 CDT

Original text of this message

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