Home > OS >  ORA-00933: SQL command not properly ended when running SP
ORA-00933: SQL command not properly ended when running SP

Time:11-17

I'm troubled with this error when running SP, I don't know why. pls help me

error in line AND thlt.CODE = ' || p_CODE|| ' when CODE is varchar2

A_ID NUMBER, P_A_Ids VARCHAR2, v_expression VARCHAR2, p_CODE VARCHAR2

...
OPEN v_cursor FOR
             ' SELECT thltCt.A_ID A_ID,
                        Sum( ' ||  v_expression || ' ) "VALUE"     
                FROM tableA thlt join tableB thltCt on thlt.ID = thltCt.THLT_ID  
                WHERE thlt.LS IS NOT NULL  
                      AND thlt.CODE  =  ' || p_CODE|| '   
                      AND thltCt.A_ID IN (' || P_A_Ids || ' )  
                GROUP BY (thltCt.A_ID)';

CodePudding user response:

From the comments i think it will work like this :

' SELECT thltCt.A_ID A_ID,
                        Sum( ' ||  v_expression || ' ) "VALUE"     
                FROM tableA thlt join tableB thltCt on thlt.ID = thltCt.THLT_ID  
                WHERE thlt.LS IS NOT NULL  
                      AND thlt.CODE  =  '' ' || p_CODE|| ' ''  
                      AND thltCt.A_ID IN ( ' || P_A_Ids || ' )  
                GROUP BY (thltCt.A_ID)';
  • Related