Home » SQL & PL/SQL » SQL & PL/SQL » Disallowing INSERT using Trigger
Disallowing INSERT using Trigger [message #36409] Mon, 26 November 2001 07:46 Go to next message
Nehal
Messages: 2
Registered: November 2001
Junior Member
CREATE OR REPLACE TRIGGER tr_test
BEFORE INSERT ON test
FOR EACH ROW

DECLARE
BEGIN
if :new.id >= 13 then
/* COMMENTS
If this condition is true, then i need to stop the INSERT statement from executing. How to do this????
*/
end if;

END tr_test;
Thnks..

----------------------------------------------------------------------
Re: Disallowing INSERT using Trigger [message #36410 is a reply to message #36409] Mon, 26 November 2001 08:18 Go to previous messageGo to next message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
CREATE OR REPLACE TRIGGER tr_test
BEFORE INSERT ON test
FOR EACH ROW
DECLARE
BEGIN
if :new.id >= 13 then
/* COMMENTS
If this condition is true, then i need to stop the INSERT statement from executing. How to do this????
*/
raise_application_error(-20001,'operation not allowed');
end if;

END tr_test;

----------------------------------------------------------------------
Re: Disallowing INSERT using Trigger [message #36412 is a reply to message #36409] Mon, 26 November 2001 10:23 Go to previous message
Nehal
Messages: 2
Registered: November 2001
Junior Member
Thanks Suresh....

----------------------------------------------------------------------
Previous Topic: how can I read in PL/SQL procedure values of html multiple select
Next Topic: How to ignore errors and finish the loop?
Goto Forum:
  


Current Time: Sun Mar 29 23:54:52 CDT 2020