Solved

PLS-00103: Encountered the symbol "LOOP"

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
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…

914 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

17 Experts available now in Live!

Get 1:1 Help Now