Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Oracle
create or replace trigger trg_m_service
after update on m_service
for each row
declare
begin
 if updating(SRM_THEFT_CASE_STATUS)then
  update m_servicemaster@collection
  set srm_theft_tag@collection =:new.SRM_THEFT_CASE_STATUS,
  srm_theft_amt@collection =:new.srm_theft_amt,srm_modify_date=sysdate
  where :new.srm_service_no=srm_service_no@collection;
 end if;
end;
Posted 30-Dec-11 19:09pm
Edited 30-Dec-11 19:15pm
Mehdi Gholam233.9K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

begin
 if updating(SRM_THEFT_CASE_STATUS)then
  update m_servicemaster@collection
  set srm_theft_tag@collection =:new.SRM_THEFT_CASE_STATUS,
  srm_theft_amt@collection =:new.srm_theft_amt,srm_modify_date=sysdate
  where :new.srm_service_no=srm_service_no@collection;
 end if;
end;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use prefix :Old and :New to test if column value as changed
 
create or replace trigger trg_m_service
after update on m_service
for each row
Begin
If :Old.SRM_THEFT_CASE_STATUS != :New.SRM_THEFT_CASE_STATUS Then
 
-- your update
 
End If;
 
End;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Nirav Prabtani 318
1 OriginalGriff 227
2 Sergey Alexandrovich Kryukov 216
3 Mika Wendelius 185
4 CPallini 170
0 Nirav Prabtani 284
1 OriginalGriff 217
2 Sergey Alexandrovich Kryukov 196
3 Mika Wendelius 185
4 CPallini 170


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 7 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100