We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to delete files in a directory after dropping the directory object

Question
9
Views
0
Comments
edited Apr 16, 2022 7:55AM in Autonomous Database

Summary

How to delete files in a directory after dropping the directory object

Content


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

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!