disallowing insert into table using trigger without error message... [message #37128] |
Sat, 19 January 2002 18:29 |
alex hijazi
Messages: 1 Registered: January 2002
|
Junior Member |
|
|
hey guys,
I would like to disallow an insert into a table but without any error message showing...
CREATE OR REPLACE TRIGGER no_trade
before insert on br_orders_trig
for each row
declare
p_atype number; /* Account type 1/0 if 1 then paper trade */
begin
select account_type into p_atype from br_account where account_id=:new.account_id;
if p_atype=1 then
:new.order_status:=-2;
raise_application_error(-20001,'Just Paper Trade...');
end if;
end;
Fortunately the above stops the insert but am left with an ugly message. I would like the user to continue without seeing an error.
Please Help...
Thanks in advance.
ALEX
|
|
|
Re: disallowing insert into table using trigger without error message... [message #37134 is a reply to message #37128] |
Sun, 20 January 2002 07:38 |
Suresh Vemulapalli
Messages: 624 Registered: August 2000
|
Senior Member |
|
|
it is not possible to stop error being displayed when you issue insert statement from sqlplus. but you can supress that message from calling program
ex:
declare
x exception;
pragma exception_init(x,-20001);
begin
insert into table1 values('kkk');
exception
when x then
null;
end;
or
if you are issuing this sql statement from client program, suppress that message using sqlcode.
|
|
|