Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PLS-00103: Encountered the symbol "LOOP"

Posted on 2006-06-26
3
Medium Priority
?
4,209 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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 how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

886 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