• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

Problem with an insert into Glocal Temporary Table

Hi ,

 
   Attaching my stored procedure where i have the problem.
   The error it is throwing is :
[IBM][CLI Driver][DB2/AIX64] SQL0104N  An unexpected token "END FOR" was found following "GENERAL_NEGLECT);   ".  Expected tokens may include:  "<psm_statement>".  LINE NUMBER=163.  SQLSTATE=42601

Open in new window


Can someone kindly help me understand what's wrong?
TEST-SQL.txt
0
pvsbandi
Asked:
pvsbandi
  • 3
  • 3
1 Solution
 
momi_sabagCommented:
you have an end for on line 163 but no where in the code did you start a loop
0
 
pvsbandiAuthor Commented:
Hi Momi,

   I have a "For C1 as" in the code.
0
 
momi_sabagCommented:
i never saw that syntax style before
are you sure its valid?
what happens if you remove the insert statement from the end of the loop?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
pvsbandiAuthor Commented:
I get this error, when i removed the insert and  p2 sections.

SQL0104N  An unexpected token "FOR C1 AS  SELECT          TB_SCREEN" was found following ") WITH REPLACE;  ".  Expected tokens may include:  "<psm_statement>".  LINE NUMBER=167.  SQLSTATE=42601
0
 
momi_sabagCommented:
i would try to make as simple as possible
change you query of the loop to something like select * from sysibm.sysdummy1
then in the loop remove all the statements

once that works, revert back to your original query
once that works start adding the if statements in the loop

until you find what breaks it
0
 
pvsbandiAuthor Commented:
Thanks so much! that really helped.
  I forgot a END IF in the code and it was hard to find.
Your advise worked greatly.
Thanks again!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now