I have this procedure that i am trying to create to insert rows but needing to sum the amt of one field. The procedure is created but when executed I receive the ORA-02287: sequence number not allowed here. If i take the sum of the amt out of the query and remove the group by clause - it works fine.

CREATE OR REPLACE PROCEDURE cmi_copy2
AS
BEGIN

INSERT INTO COMMUNITY_PROGRAMS
( LEVEL_KEY,
COMM_HEALTH_SEQ_NO,
COMM_HEALTH_DESC,
START_YEAR,
START_QTR_ENDING_MONTH,
END_YEAR,
END_QTR_ENDING_MONTH,
NO_INDIVIDUALS,
CREATE_DATE,
CREATE_USERID,
UPDATE_DATE,
UPDATE_USERID,
PROGRAM_TYPE)
SELECT
VRU.LOCATION,
COMM_HEALTH_SEQ.NEXTVAL,
MD.METRIC_DESC,
MMD.YEAR,
NULL,
NULL,
NULL,
sum(MMD.METRIC_AMT),
SYSDATE,
'INITCOPY',
SYSDATE,
'INITCOPY',
'HLTH'
FROM METRICS_MONTHLY_DETAIL MMD, METRICS_DEFINITION MD, V_REPORT_ROLL_UP_BU VRU
WHERE MMD.METRIC_SEQ_NO = MD.METRIC_SEQ_NO AND
VRU.LOCATION_SEQ_NO = MMD.LOC_SEQ_NO AND
MD.METRIC_TYPE_ID = 'CMI'
GROUP BY
VRU.LOCATION,
MD.METRIC_DESC,
MMD.YEAR;
END cmi_copy;
/

Any help is appreciated
Thanks in advance