Error (11.15): PL / SQL: ORA-04044: procedure, function, package or type are not allowed here

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; 
+4
source share
1 answer

DATE is a reserved keyword in Oracle. Your procedure should not compile even if it contains the insert statement you posted. If you intend to use DATE for the table name, put it in quotation marks:

 INNER JOIN "DATE" ON X.DATE_NUM="DATE".DATE_NUM 
+3
source

All Articles