Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error(11,15): PL/SQL: ORA-04044: procedure, function, package, or type is not allowed here

I am trying to get data from 4 tables FACTS_CDPM, PRODUCT, CUSTOMER, DATE into CUST_ALLOC table, when I just run the select query, i get the result, but when I put it inside a procedure and do an insert into with the select statement as below, I get an error "Error(11,15): PL/SQL: ORA-04044: procedure, function, package, or type is not allowed here"

Please can somebody help as to why this is happening?

Thank you!

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;
like image 254
user663354 Avatar asked Oct 12 '22 03:10

user663354


1 Answers

DATE is a reserved keyword in Oracle. Your procedure shouldn't even compile if it contained the insert statement you posted. If you're going to use DATE for a table name, put it in quotes:

INNER JOIN "DATE" ON X.DATE_NUM="DATE".DATE_NUM
like image 145
vls Avatar answered Oct 14 '22 20:10

vls