trigger [message #71813] |
Wed, 15 January 2003 15:09 |
Pratibha
Messages: 29 Registered: November 2001
|
Junior Member |
|
|
ORDER ITEMC QTY_ORD QTY_DELD
----- ----- ---------- ----------
o001 i001 50 70
o002 i002 40 40
create or replace trigger orders before insert on order_detail for each row
declare
orno order_detail.orderno%type;
begin
select orderno into orno from order_detail
where qty_ord(is less than)qty_deld;
if orno='001'then
raise_application_error(-20001,'enter some other number');
end if;
end;
/
Trigger created
SQL> insert into order_detail values('o003','i003',30,30);
insert into order_detail values('o003','i003',30,30)
*
ERROR at line 1:
ORA-20001: enter some other number
ORA-06512: at "RANI.ORDERS", line 6
ORA-04088: error during execution of trigger 'RANI.ORDERS'
SQL> insert into order_detail values('o001','i003',40,40);
insert into order_detail values('o001','i003',40,40)
*
ERROR at line 1:
ORA-20001: enter some other number
ORA-06512: at "RANI.ORDERS", line 6
ORA-04088: error during execution of trigger 'RANI.ORDERS'
*When I post this message,in posted message,less than symbol not coming,that's why for your understanding I write.
Please explain what happened .
Thank's for your help
|
|
|
|
Re: trigger [message #71817 is a reply to message #71815] |
Wed, 15 January 2003 15:56 |
Pratibha
Messages: 29 Registered: November 2001
|
Junior Member |
|
|
Thank u.
I got what you elucidated.
next,If I give another name inplace of 'samples',it would be inserted.Is this right?
regards
pratibha
|
|
|