Re: Database Trigger not fireing In Delete Mode

2002-10-11 Thread Chaim . Katz


Naba,

I think you need something like this
CREATE OR REPLACE TRIGGER triggername
AFTER INSERT OR UPDATE OR DELETE
ON tablename
FOR EACH ROW
WHEN (NVL(new.fldname1,old.fldname1)is not null and
  NVL(new.fldname2,old.fldname2)is not null)
DECLARE
BEGIN
  processing goes here
END;


hth,
Chaim




[EMAIL PROTECTED] (N J Neog)@fatcity.com on 10/11/2002 12:13:26 AM

Please respond to [EMAIL PROTECTED]

Sent by:[EMAIL PROTECTED]


To:Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
cc:




Hi all,

I have  row level table trigger  to  fire on DELETE or INSERT or UPDATE
Mode .
It has to fire  on certain condition, meaning I have a WHEN condition also.

WHEN Condition is like :
   when (  NEW.CR_ACCOUNT is not null and   NEW.CHQ_DT is not null )

Since, in DELETE mode NEW value  contains null  ,  it does not fire.

This Problem would have solved if could write  WHEN Condition as


   when  ((INSERTING or UPDATING) and NEW.CR_ACCOUNT is not null
   and   NEW.CHQ_DT is not null ) OR
     (DELETING and OLD.CR_ACCOUNT is not null  and   OLD.CHQ_DT
is not null )


But in WHEN condition one can not write  INSERTING or UPDATING.

How do i go about it ? Any round about way

Thanks & Regards.

Naba





--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Database Trigger not fireing In Delete Mode

2002-10-11 Thread Jamadagni, Rajendra
Title: RE: Avoding Mutation of Table trigger



This can be simply solved by eliminating the WHEN condition on the 
trigger and encapsulating that condition as part of a If .. THEN ... END IF 
statement.
 
Raj
__
Rajendra 
Jamadagni  
    MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot 
com
Any opinion expressed here is 
personal and doesn't reflect that of ESPN Inc. 
QOTD: Any clod can have facts, but 
having an opinion is an art!

  -Original Message-From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, October 11, 2002 12:13 
  AMTo: Multiple recipients of list ORACLE-LSubject: 
  Database Trigger not fireing In Delete Mode
  Hi all,
   
  I have  row level table trigger  to 
  fire on DELETE or INSERT or UPDATE Mode . 
  It has to fire on certain condition, meaning I have a WHEN condition 
  also.
   
  WHEN Condition is like :
     when ( 
  NEW.CR_ACCOUNT is not null and   NEW.CHQ_DT is not null 
  )
   
  Since, in DELETE mode NEW value 
  contains null  ,  it does not fire.
   
  This Problem would have solved if could write 
  WHEN Condition as 
  
   
     when 
  ((INSERTING or UPDATING) and NEW.CR_ACCOUNT is not null 
    
  and   NEW.CHQ_DT is not null ) OR
      
  (DELETING and OLD.CR_ACCOUNT is not null  and   OLD.CHQ_DT is not null )
   
  But in WHEN condition one can not write 
  INSERTING or UPDATING.
   
  How do i go about it ? Any round about way 
  ?
   
  Thanks & Regards.
   
  Naba
   
*This e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*1



Database Trigger not fireing In Delete Mode

2002-10-10 Thread N J Neog
Title: RE: Avoding Mutation of Table trigger



Hi all,
 
I have  row level table trigger  to 
fire on DELETE or INSERT or UPDATE Mode . 
It has to fire 
on certain condition, meaning I have a WHEN condition also.
 
WHEN Condition is like :
   when ( 
NEW.CR_ACCOUNT is not null and   NEW.CHQ_DT is not null )
 
Since, in DELETE mode NEW value 
contains null  ,  it does not fire.
 
This Problem would have solved if could write 
WHEN Condition as 

 
   when 
((INSERTING or UPDATING) and NEW.CR_ACCOUNT is not null 
  
and   NEW.CHQ_DT is not null ) OR
    
(DELETING and OLD.CR_ACCOUNT is not null  and   OLD.CHQ_DT is not null )
 
But in WHEN condition one can not write 
INSERTING or UPDATING.
 
How do i go about it ? Any round about way 
?
 
Thanks & Regards.
 
Naba