Oracle11g 在oracle存储过程中对sql语句进行分组

Oracle11g 在oracle存储过程中对sql语句进行分组,oracle11g,Oracle11g,在对oracle存储过程中的sql语句进行分组时,我遇到了错误。请查看我的代码选择count(decode(msg_trans_type,'EXCH','Y',NULL))EXCH到total_exchange_请求中,count(decode(msg_trans_type,'BUY','Y',NULL))购买到total_BUY_请求中,count(decode(msg_trans_type,'SELL','Y',NULL))将来自tra_消息的请求全部出售,其中msg_service_pro

在对oracle存储过程中的sql语句进行分组时,我遇到了错误。请查看我的代码选择count(decode(msg_trans_type,'EXCH','Y',NULL))EXCH到total_exchange_请求中,count(decode(msg_trans_type,'BUY','Y',NULL))购买到total_BUY_请求中,count(decode(msg_trans_type,'SELL','Y',NULL))将来自tra_消息的请求全部出售,其中msg_service_provider=in_svc_provider和trunc(msg_when_created)=to_date(in_start_date,'dd-mon-yyyy');我收到错误(15,17):PL/SQL:ORA-00934:此处不允许使用组函数。请查看并提出您的意见。

您使用了错误的语法

尝试:

select count(decode(msg_trans_type,'EXCH','Y',NULL)) EXCH,
       count(decode(msg_trans_type,'BUY','Y',NULL)) BUY,
       count(decode(msg_trans_type,'SELL','Y',NULL)) SELL
INTO total_exchange_requests, total_buy_requests, total_sell_requests
...