I have created some Procedures in SQL Developer, and they are working fine. However I am now creating a Package to include all those Procedures, and can’t seem to figure out the right way to code the Package as it returns the following error (refering to the PACKAGE BODY’s CREATE):
PLS-00103: Encountered the symbol "CREATE"
Here is my code:
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;
I have done some searching and the only thing I can think of is maybe some problem related to the definition on the CURSOR…not sure though. Thanks in advance
I successfully ran this in sqlplus and sqldeveloper (F5 in sqldeveloper: “Run Script”). I changed the two dml statements since my schema is different.