How to delete files in a directory after dropping the directory object
Summary
How to delete files in a directory after dropping the directory objectContent
Hi guys,
I created a directory object and copied a file into it from an object storage.
Then, I dropped the directory object and as a result the file is still there.
I want to delete the created directory and the file that it contains so I tried using DBMS_CLOUD.DELETE_FILE procedure. But it returns ORA-20019.
How can I delete that file and its parent directory?
Here is what I got:
SQL> SELECT OBJECT_NAME FROM DBMS_CLOUD.list_files('ROOT_DIR');
OBJECT_NAME
--------------------------------------------------------------------------------
stage/Wallet_atporadb.zip
SQL> DROP DIRECTORY staging ;
Directory dropped.
SQL> SELECT OBJECT_NAME FROM DBMS_CLOUD.list_files('ROOT_DIR');
OBJECT_NAME
--------------------------------------------------------------------------------
stage/Wallet_atporadb.zip
SQL> exec DBMS_CLOUD.DELETE_FILE ( directory_name =>'', file_name =>'stage/Wallet_atporadb.zip');
BEGIN DBMS_CLOUD.DELETE_FILE ( directory_name =>'', file_name =>'stage/Wallet_atporadb.zip'); END;
*
ERROR at line 1:
ORA-20018: Missing directory name
ORA-06512: at "C##CLOUD$SERVICE.DBMS_CLOUD", line 989
ORA-06512: at "C##CLOUD$SERVICE.DBMS_CLOUD", line 2928
ORA-06512: at line 1 0