Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 25 Jan 2005 @ 17:37:00 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Syntax error in trigger code
 
From:   Pinti, Michele A

This is the first trigger that we have tried so we may have overlooked the obvious but we get this message on the following code

Syntax error: expected something between the ')' and the 'WHEN' keyword.


If we remove the second WHEN and code following it the trigger will execute. Is there any idea as to what I have coded wrong?

     Replace TRIGGER PRODOPD.Nightly_Profile_Trigger
     AFTER Update ON PRODOPD.SoNY_Practitioner_Profile
     REFERENCING OLD AS OldRow NEW AS NewRow
     FOR EACH ROW

     WHEN (OldRow.NYS_Profession_Code <> NewRow.NYS_Profession_Code)
     INSERT INTO PRODOPD.SoNY_Practitioner_Profile_Hist
     VALUES (100, OldRow.Spp_id, 'NYS_Profession_Code',
     OldRow.NYS_Profession_Code,NewRow.NYS_Profession_Code,
     OldRow.Source_Sys_Origin_Cd,OldRow.Source_Create_Ts,
     OldRow.Updated_By_Source_Sys_Cd,OldRow.Updated_By_Source_Sys_Ts,
     OldRow.Modified_By_Nm,OldRow.Modified_Ts,OldRow.Created_Ts,OldRow.Loaded_Ts)

     WHEN (OldRow.NYS_Profession_Text <> NewRow.NYS_Profession_Text)
     INSERT INTO PRODOPD.SoNY_Practitioner_Profile_Hist
     VALUES (101, OldRow.Spp_id, 'NYS_Profession_Text',
     OldRow.NYS_Profession_Text,NewRow.NYS_Profession_Text,
     OldRow.Source_Sys_Origin_Cd,OldRow.Source_Create_Ts,
     OldRow.Updated_By_Source_Sys_Cd,OldRow.Updated_By_Source_Sys_Ts,
     OldRow.Modified_By_Nm,OldRow.Modified_Ts,OldRow.Created_Ts,OldRow.Loaded_Ts)


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016