oracle 错误 (11,15): PL/SQL: ORA-04044: 过程、函数、包或类型在这里是不允许的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5890851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error(11,15): PL/SQL: ORA-04044: procedure, function, package, or type is not allowed here
提问by user663354
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"
我试图从 4 个表 FACTS_CDPM、PRODUCT、CUSTOMER、DATE 中获取数据到 CUST_ALLOC 表中,当我运行 select 查询时,我得到了结果,但是当我把它放在一个过程中并使用 select 语句插入到如下所示,我收到错误消息“错误(11,15):PL/SQL:ORA-04044:此处不允许使用过程、函数、包或类型”
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;
回答by vls
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:
DATE
是 Oracle 中的保留关键字。如果您的过程包含您发布的插入语句,则它甚至不应编译。如果要使用 DATE 作为表名,请将其放在引号中:
INNER JOIN "DATE" ON X.DATE_NUM="DATE".DATE_NUM