I try to get data from 4 tables FACTS_CDPM, PRODUCT, CUSTOMER, DATE in the table CUST_ALLOC, when I just run the select query, I get the result, but when I put it inside the procedure and paste it into the select statement, as shown below, I get a message about the error "Error (11.15): PL / SQL: ORA -04044: procedure, function, package or type is not allowed here.
Please help someone help, why is this happening?
Thanks!
INSERT INTO CUST_ALLOC (PART_ID, CUSTOMER, MONTH, QTY_ALLOCATED ) SELECT P.PROD_ID, C.PURCHASING, D.MONTH_ID, SUM(X.QTY) FROM FACTS_CDPM X INNER JOIN PRODUCT P ON P.PROD_NUM=X.PROD_NUM INNER JOIN CUSTOMER C ON X.CUST_NUM=C.CUST_NUM INNER JOIN DATE D ON X.DATE_NUM=D.DATE_NUM WHERE MEASURE_NUM=18 GROUP BY P.PROD_ID,C.PURCHASING,D.MONTH_ID;
source share