Solved

PLS-00103: Encountered the symbol "LOOP"

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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Oracle SQL - Query help 7 78
Oracle DB monitor SW 21 72
SQL Workhours Count beetween Workhours 3 39
Excess Redo 3 32
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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.
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.
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…

756 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