我在 SQL Developer 中创建了一些程序,它们工作正常。但是,我现在正在创建一个包以包含所有这些程序,并且似乎无法找出正确的方法来对包进行编码,因为它返回以下错误(参考 PACKAGE BODY 的 CREATE):
PLS-00103: Encountered the symbol "CREATE"
这是我的代码:
CREATE OR REPLACE PACKAGE package_test AS
PROCEDURE copy_object;
END package_test;
CREATE OR REPLACE PACKAGE BODY package_test AS
PROCEDURE copy_object IS
CURSOR object_cursor IS
SELECT COD_OBJECT, OBJECT_NAME FROM OBJECT;
object_rec object_cursor%rowtype;
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE DATABASE2.D_OBJECT';
FOR object_rec IN object_cursor
LOOP
INSERT INTO DATABASE2.D_OBJECT (COD_OBJECT,OBJECT_NAME) VALUES (object_rec.OOD_OBJECT,object_rec.OBJECT_NAME);
END LOOP;
COMMIT;
END copy_object;
END package_test;
我做了一些搜索,我唯一能想到的可能是与 CURSOR 上的定义相关的一些问题……但不确定。提前致谢