Home » RDBMS Server » Server Utilities » Trigger
Trigger [message #71903] Thu, 30 January 2003 10:26 Go to next message
Pratibha
Messages: 29
Registered: November 2001
Junior Member
Thank you vermuch

**I understand that already table has orderno=o001,trigger won't allow to insert any record**

I have one more doubt that is

create or replace trigger order_detail before insert on order_detail for each row

declare
orno order_detail.orderno%type;
begin
select orderno inot orno from order_detail where qty_ord<qty_deld;

if orno='o001'then

[[here it compares with orno where qty_ord<qty_deld;It means if table has orno where qty_ord<qty_deld is equivalent to o001,trigger is fired,If this is right,It has to display given message]]

[[why It's not displaying given message?]]

raise_application_error(-20001,'qty_deld is more than qty_ord');
end if;
end;
/
Re: Trigger [message #71904 is a reply to message #71903] Thu, 30 January 2003 10:53 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
actually,
you wont see a message (like when u use a dbms_output).
you will see your text in the error stack along with the number you have entered in raise_app_err
process STOPS if it encounters a raise_app_err.
even if u use dbms_output u will not get a clear message as
shown...

----------------------------------------------------------------------

mag@itloaner1_local > ed
Wrote file afiedt.buf

  1  declare
  2  a number:=í
  3  begin
  4      if a<>1 then
  5     DBMS_OUTPUT.PUT_LINE('before raise application --- U HAVE NOOOT ENTERED 1');
  6             raise_application_error(-20000,'should be 1');
  7     DBMS_OUTPUT.PUT_LINE('after raise application----- U HAVE NOOOT ENTERED 1');
  8      ELSE
  9     DBMS_OUTPUT.PUT_LINE('U HAVE ENTERED 1');
 10      end if;
 11* end;
mag@itloaner1_local > /
Enter value for nu: 1
old   2: a number:=í
new   2: a number:=1;
U HAVE ENTERED 1

PL/SQL procedure successfully completed.

mag@itloaner1_local > /
Enter value for nu: 2
old   2: a number:=í
new   2: a number:=2;
before raise application --- U HAVE NOOOT ENTERED 1
declare
*
ERROR at line 1:
ORA-20000: should be 1

Previous Topic: Trigger
Next Topic: Archivelog List Problem
Goto Forum:
  


Current Time: Wed May 15 02:36:23 CDT 2024