I've only started trying to program PL/SQL packages and am having quite a lot of trouble, procedures on there own I can handle but when I try to compile the following code I get the subsequent error Any ideas why:
CREATE OR REPLACE PACKAGE archive_database AS
PROCEDURE select_data(v_owner IN VARCHAR2);
CURSOR c1 IS SELECT table_name FROM DBA_TABLES WHERE OWNER = v_owner;
END archive_database;
/
CREATE OR REPLACE PACKAGE BODY archive_database AS
PROCEDURE select_data(v_owner IN VARCHAR2) IS
fHandle UTL_FILE.FILE_TYPE;
BEGIN
fHandle:=UTL_FILE.FOPEN('F:\oracle\orasvr\admin\CLDTEST\arch\','archivedata.txt','w');
UTL_FILE.PUT_LINE(fHandle,'File Begin');
OPEN c1;
LOOP
FETCH c1 INTO BULK;
EXIT WHEN c1%NOTFOUND;
UTL_FILE.PUT(fHandle,'<schema>:' || 'CLAUDEDEMO:' || '<table>:' || c1.table_name);
END LOOP;
UTL_FILE.PUT_LINE(fHandle,'End File');
UTL_FILE.CLOSE(fHandle);
END select_data;
END archive_database;
/
Errors for PACKAGE BODY ARCHIVE_DATABASE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/14 PLS-00905: object CLAUDEDEMO.ARCHIVE_DATABASE is invalid
1/14 PLS-00304: cannot compile body of 'ARCHIVE_DATABASE' without its
specification
cheers.
CREATE OR REPLACE PACKAGE archive_database AS
PROCEDURE select_data(v_owner IN VARCHAR2);
CURSOR c1 IS SELECT table_name FROM DBA_TABLES WHERE OWNER = v_owner;
END archive_database;
/
CREATE OR REPLACE PACKAGE BODY archive_database AS
PROCEDURE select_data(v_owner IN VARCHAR2) IS
fHandle UTL_FILE.FILE_TYPE;
BEGIN
fHandle:=UTL_FILE.FOPEN('F:\oracle\orasvr\admin\CLDTEST\arch\','archivedata.txt','w');
UTL_FILE.PUT_LINE(fHandle,'File Begin');
OPEN c1;
LOOP
FETCH c1 INTO BULK;
EXIT WHEN c1%NOTFOUND;
UTL_FILE.PUT(fHandle,'<schema>:' || 'CLAUDEDEMO:' || '<table>:' || c1.table_name);
END LOOP;
UTL_FILE.PUT_LINE(fHandle,'End File');
UTL_FILE.CLOSE(fHandle);
END select_data;
END archive_database;
/
Errors for PACKAGE BODY ARCHIVE_DATABASE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/14 PLS-00905: object CLAUDEDEMO.ARCHIVE_DATABASE is invalid
1/14 PLS-00304: cannot compile body of 'ARCHIVE_DATABASE' without its
specification
cheers.