Skip to Main Content

Oracle Database Express Edition (XE)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Error] Compilation (10: 9): PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: * & - + / at

user-7iqvtOct 23 2023

Error while compiling the function,

CREATE FUNCTION get_oic(c IN VARCHAR2)

RETURN VARCHAR2

IS

   a VARCHAR2(8) := c;        
   RES  BOOLEAN := FALSE;    
   b VARCHAR2(8) :='00000000';  
   CNT NUMBER :=0;  
   SUBCNT NUMBER :=0;  

BEGIN

   WHILE RES != TRUE  
     LOOP         
       select COUNT(a.d) into CNT from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a) and b.GRADE in ('A','B','C');  
         
       IF CNT = 1 THEN    
                   
           RES := TRUE;  
           select a.d into b from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a) and b.GRADE in ('A','B','C');                    
             
       ELSE   
                     
           Select COUNT(a.d) into SUBCNT from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a);  
           IF SUBCNT = 1 THEN              
               RES := FALSE;  
               select a.d into a from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a);   
           ELSE     
               RES := TRUE;          
               b := 'NOT FND'   ;                                  
           END IF;    
                                  
       END IF;      
     END LOOP;    
      
   RETURN(b);   

END;
/

Comments
Post Details
Added on Oct 23 2023
0 comments
148 views