Hi, AS400 – SQL triggers for tables

305 pts.
Tags:
AS400 - SQL Triggers

Hi,

1.Could any one let me know whether AS400 SQL Triggers will accept cursors.

2. DOW is also not accpeting.Instead i tried the below code, but even then i am getting SQL0104 error.

Declare c1 Cursor For                    

 Select STATUS  from T_RODTLS TR          

  Where                                   

 TR.COMPANY_CODE = @Company  and          

 TR.VPC_CODE =  @VPC          and         

 TR.TP_CODE  =  NR1.TP_CODE   and         

 TR.SRV_CD   <> NR1.SRV.CD ;              

                                          

DECLARE CONTINUE HANDLER FOR NOT FOUND    

    SET AT_END  =  1;                     

 OPEN c1;                                 

 FETCH_LOOP:                              

 LOOP                                     

  Fetch c1 into @Status;                  

   IF at_end = 1 THEN                      

     /* Send the outbound */              

       Set @DntSnd = @No;                                 

      LEAVE FETCH_LOOP;                                   

     ELSEIF  @Status <>'CMPLT' and @Status <>'CANCL' THEN 

        Set @DntSnd = @No;                                

       ITERATE FETCH_LOOP;                                

     ELSEIF  @Status = 'CMPLT' or  @Status <>'CANCL' THEN 

        Set @DntSnd = @Yes;                               

      LEAVE FETCH_LOOP;                                    

     End If;                                              

   END LOOP;                                              

CLOSE c1;                      

Could somebody suggest pls?

Thanks ,

P.Amutha



Software/Hardware used:
Software

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Declare c1 Cursor For 
     Select STATUS  from T_RODTLS TR 
      Where 
     TR.COMPANY_CODE = @Company  and 
     TR.VPC_CODE =  @VPC          and 
     TR.TP_CODE  =  NR1.TP_CODE   and 
     TR.SRV_CD   <> NR1.SRV.CD ; 

    NR1 doesn't appear to be defined anywhere.

    Tom

    125,585 pointsBadges:
    report
  • As400pgmmer

    Hi,

    NR1 is a new value defined on sql trigger. SQL trigger on tables is not accepting the cursor definition itself

    Thanks

    Amutha

    305 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following