我正在尝试使用Oracle
创建一个包含存储过程的包在检查所有表字段被删除后进行编译和执行时,
我有SQL statement ignored
和ORA-00926 for VALUES
请您告诉我是否有任何指导方针可以检查这些错误或我应该关注哪种语法?
下面是我的SQL脚本
CREATE OR REPLACE PACKAGE BODY TESTAS
PROCEDURE GETREPORT01 IS
BEGIN
EXECUTE IMMEDIATE "TRUNCATE TABLE TESTER.TEST_TB1";
INSERT INTO TESTER.TEST_TB1
SELECT
ACCOUNT_NUMBER,
SERVICE_ADDRESS_ID,
BILLING_CYCLE,
CUSTOMER_STATUS,
CUSTOMER_TYPE,
SUKET_NEW
FROM
ABC.DWH_BUCKETS
WHERE
CUSTOMER_TYPE = 'DIY'
ORDER BY
DECODE(CUSTOMER_STATUS, 'AC', 1, 'IN', 2, 3) DESC;
END GETREPORT01;
答案 0 :(得分:1)
根据您的代码,您错过了第一行中的IS
关键字和最后一行中的END;
CREATE OR REPLACE PACKAGE BODY TESTAS IS
PROCEDURE GETREPORT01 IS
BEGIN
EXECUTE IMMEDIATE "TRUNCATE TABLE TESTER.TEST_TB1";
INSERT INTO TESTER.TEST_TB1
SELECT
ACCOUNT_NUMBER,
SERVICE_ADDRESS_ID,
BILLING_CYCLE,
CUSTOMER_STATUS,
CUSTOMER_TYPE,
SUKET_NEW
FROM
ABC.DWH_BUCKETS
WHERE
CUSTOMER_TYPE = 'DIY'
ORDER BY
DECODE(CUSTOMER_STATUS, 'AC', 1, 'IN', 2, 3) DESC;
END GETREPORT01;
END TESTAS;
答案 1 :(得分:1)
尝试此查询:
CREATE OR REPLACE PACKAGE PKG_TEST IS
PROCEDURE GETREPORT01;
END;
/
CREATE OR REPLACE PACKAGE BODY PKG_TEST AS
PROCEDURE GETREPORT01 IS
BEGIN
EXECUTE IMMEDIATE "TRUNCATE TABLE TESTER.TEST_TB1";
INSERT INTO TESTER.TEST_TB1
SELECT
ACCOUNT_NUMBER,
SERVICE_ADDRESS_ID,
BILLING_CYCLE,
CUSTOMER_STATUS,
CUSTOMER_TYPE,
SUKET_NEW
FROM
ABC.DWH_BUCKETS
WHERE
CUSTOMER_TYPE = 'DIY'
ORDER BY
DECODE(CUSTOMER_STATUS, 'AC', 1, 'IN', 2, 3) DESC;
END GETREPORT01;
END;
/