Solved

PLS-00103: Encountered the symbol "LOOP"

Posted on 2006-06-26
3
3,829 Views
Last Modified: 2008-02-01
Hi, I created a nested looping, it gave me 2 errors as
PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: if

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin function package pragme procedure form.

The coding as bellow:
begin                       
     open c_oh_pro;    
     for y in 1..15
     loop
         fetch c_oh_pro into r_oh_pro;
         exit when c_oh_pro%notfound;
         
         --assign all the flex field record to a variable from (1) until (7)
         v_row_count := v_row_count + 1;
         
         --(1)
         if v_row_count = y then
              v_demand(y) := r_oh_pro.demand;
              v_origin_name(y) := r_oh_pro.origin_name;
              v_seq(y) := r_oh_pro.seq;            
              v_from_ww(y) := r_oh_pro.from_ww;
              v_to_ww(y) := r_oh_pro.to_ww;
              v_ww_cal(y) := r_oh_pro.ww_cal;
              v_pto_cal(y) := r_oh_pro.pto_cal;
              dbms_output.put_line('v_demand'||y||'='||v_demand(y)||',v_origin_name'||y||'='||v_origin_name(y)||',v_seq'||y||'='||v_seq(y)||',v_from_ww'||y||'='||v_from_ww(y)||',v_to_ww'||y||'='||v_to_ww(y)||',v_ww_cal'||y||'='||v_ww_cal(y)||',v_pto_cal'||y||'='||v_pto_cal(y));
             
              --to find out which one is SUM_OF_PASTDUE & DNY_STA_SS_QTY
              if substr(v_origin_name(y),1,1)='S' or substr(v_origin_name(y),1,1)='D' then
                 v_dd_attr(y) := v_origin_name(y);
                 v_item_dd_attr(y) := v_origin_name(y);
                 v_pto_dd_attr(y) := v_origin_name(y);
                 dbms_output.put_line('v_dd_attr'||y||'='||v_dd_attr(y)||'v_item_dd_attr'||y||'='||v_item_dd_attr(y)||',v_pto_dd_attr'||y||'='||v_pto_dd_attr(y));
              else
                  --to concate the full column for 7 pieces & item-(2 pieces)
                  v_dd_attr(y) := 'WW' || v_from_ww(y);
                  dbms_output.put_line('v_dd_attr'||y||'='||v_dd_attr(y));
                  for i in v_from_ww(y)+1..v_to_ww(y)
                      loop                      
                          v_dd_attr(y):=v_dd_attr(y)||'+WW'||i;                          
                      end loop;    
                     
                  if substr(v_ww_cal(y),1,1)='M' then
                      v_dd_attr(y):='('||v_dd_attr(y)||')*'||substr(v_ww_cal(y),2,1);
                      dbms_output.put_line('v_dd_attr'||y||'='||v_dd_attr(y));
                  end if;
                                                         
                  --to concate the PTO-(2 pieces)          
                  if substr(v_pto_cal(y),1,1)='D' then
                     v_pto_dd_attr(y):='/'||substr(v_pto_cal(y),2,1);
                     dbms_output.put_line('v_pto_dd_attr'||y||'='||v_pto_dd_attr(y));
                  elsif substr(v_pto_cal(y),1,1)='M' then
                     v_pto_dd_attr(y):='*'||substr(v_pto_cal(y),2,1);
                     dbms_output.put_line('v_pto_dd_attr'||y||'='||v_pto_dd_attr(y));
                  end if;
                                   
              end if;
     end loop;     --ERROR HAPPEN HERE

QUESTION:
what causing this error?? the end loop is the end the first "for Loop" at the beginning.
anyone can help??
thanks!!!
0
Comment
Question by:wernyen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
MohanKNair earned 125 total points
ID: 16982496
There no matching "end if" for the line
>> if v_row_count = y then



Add the end if before the "end loop"
end if;
     end loop;     --ERROR HAPPEN HERE
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question