DB2 Trigger Error.

Hi,
I am trying to write a trigger on a table. I have written following code
CREATE TRIGGER QGPL/TRG_TEST                              
AFTER INSERT ON QGPL/TESTTRIGGER                              
REFERENCING NEW ROW AS NROW                      
FOR EACH ROW MODE DB2ROW                                                

WHEN (NROW.SOSTAT = 'ASSN')  
                                                           
BEGIN                                                      
  INSERT INTO QGPL/TESTTRIGGER values(NROW.SONO, 'AUTO', NROW.SOTYP);       
END

But i am getting error as
Character ''' not valid following string ',         '.              
String ');        ' contains a character that is not valid.          
Please help.
Thanks.
cavtelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:

DB2 error messages tend to steer your eyes away from the real problem.  (BTW, this isn't unique to IBM's SQL.)

Remove the ';' from the INSERT statement and try again.


Kent
Dave FordSoftware Developer / Database AdministratorCommented:
That's weird.

The following worked beautifully for me:

CREATE TRIGGER TRG_TEST                        
AFTER INSERT ON deleteme                        
REFERENCING NEW ROW AS NROW                          
FOR EACH ROW MODE DB2ROW                              
                                                     
WHEN (NROW.aVarChar = 'ASSN')                        
                                                     
BEGIN                                                
  INSERT INTO TESTTRIGGER values(NROW.aVarChar);
END

Hmmm, what am I doing differently?

DaveSlash

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB2

From novice to tech pro — start learning today.