The FREMOVE procedure removes a specified file from the system. If the file does not exist, this procedure throws an exception.
EXECUTE privilege on the UTL_FILE module.
Remove the file myfile.csv from the system.
SET SERVEROUTPUT ON@
CREATE PROCEDURE proc1()
BEGIN
DECLARE v_dirAlias VARCHAR(50) DEFAULT 'mydir';
DECLARE v_filename VARCHAR(20) DEFAULT 'myfile.csv';
CALL UTL_FILE.FREMOVE(v_dirAlias,v_filename);
CALL DBMS_OUTPUT.PUT_LINE('Removed file: ' || v_filename);
END@
CALL proc1@
This example results in the following output:
Removed file: myfile.csv