当前位置: 代码迷 >> Oracle开发 >> 总是报错 group function is not allowed here 第6行,该怎么解决
  详细解决方案

总是报错 group function is not allowed here 第6行,该怎么解决

热度:73   发布时间:2016-04-24 06:40:15.0
总是报错 group function is not allowed here 第6行


declare 
V_MKT_COUNT number(4);
V_INV_COUNT number(4);
begin
select
sum(case when LICENSE_TYPE_ID = 4 then 1 else 0 end) into V_MKT_COUNT,
sum(case when LICENSE_TYPE_ID = 1 then 1 else 0 end) into V_INV_COUNT 
from 
(SELECT distinct LM_LICENSE.LICENSE_TYPE_ID,CASE_MASTER.CASE_ID,CASE_PRODUCT.PRODUCT_ID,CASE_PRODUCT.SEQ_NUM
FROM CASE_MASTER, 
CASE_PRODUCT, LM_PRODUCT, 
LM_LIC_PRODUCTS, 
LM_LICENSE
WHERE 
CASE_MASTER.CASE_ID=CASE_PRODUCT.CASE_ID 
AND CASE_PRODUCT.PRODUCT_ID = LM_PRODUCT.PRODUCT_ID 
AND LM_PRODUCT.PRODUCT_ID= LM_LIC_PRODUCTS.PRODUCT_ID 
AND LM_LIC_PRODUCTS.LICENSE_ID= LM_LICENSE.LICENSE_ID 
and CASE_MASTER.DELETED is null 
and CASE_PRODUCT.DELETED is null 
and LM_PRODUCT.DELETED is null
and LM_LIC_PRODUCTS.DELETED is null
and LM_LICENSE.DELETED is null
AND LM_LICENSE.COUNTRY_ID=107 
AND CASE_MASTER.COUNTRY_ID=107 
and CASE_PRODUCT.PROTOCOL_FOLLOWED is null
and CASE_PRODUCT.PRODUCT_ID is not null
and CASE_MASTER.CASE_ID= 15419022
and CASE_PRODUCT.PRODUCT_ID= 101943
and CASE_PRODUCT.SEQ_NUM= 34136558) TARGET_DATA
group by CASE_ID;

dbms_output.put_line(V_MKT_COUNT);
dbms_output.put_line(V_INV_COUNT);
end;


------解决方案--------------------
select a into v_a,b into v_b

==>

select a,b into v_a,v_b
  相关解决方案