Ja, du kan tømme filen for indhold, altså få en nul-længde fil, men jeg har ikke kunnet finde ud af at slette filen, med mindre at host kald er blevet brugt.
utl_file pakken kan ikke slette, men tømme dine filer. Du kan så have fx. et crom job der ryder op engang imellem i alle tomme filer.
Ellers kan du bruge java:
CREATE OR REPLACE FUNCTION delete_file (file IN VARCHAR2) RETURN NUMBER AS LANGUAGE JAVA NAME \'JavaDelete.delete(java.lang.String) return int\'; /
CREATE OR REPLACE JAVA SOURCE NAMED \"JavaDelete\" AS import java.io.File; public class JavaDelete { public static int delete (String fileName) { File myFile = new File (fileName); boolean sucessfull = myFile.delete(); if (sucessfull) return 1; else return 0; } } /
Give grants and synonyms to this function as you use to do. Additionally you will have to grant access to your local files logging in as SYS or SYSTEM in SQL+ and execute:
Replace <your_user> by the oracle schema to which you installed the java-code. And replace <your_directory> and the slash by a backslash if you are under NT. (I didn\'t try if it works with slash under NT). Replace the asterisk (* is a wildcard) by a filename or combine it with a filename if you want to restrict access.
Jeg har valgt at lave batfil som sletter filen i stedet.
Tak for hjælpen!
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.