Solved

PLS-00103: Encountered the symbol "LOOP"

Posted on 2006-06-26
3
3,572 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now