Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to delete a flat file in SQL
Jonathan Lewis wrote:
>
> You mean something like:
> execute dbms_backup_restore.deletefile('$ORACLE_HOME/bin/oracle')
>
> (I'm not sure the $ORACLE_HOME bit would literally work
> by the way).
>
> It's certainly a case where you should hide the procedure
> call in a package which exposes only the deletefile()
> procedure from the dbms_backup_restore package.
> (A bit like the dbms_lock, user_lock packages).
> In that case, you could always wrap the call in a piece
> of code (e.g. asks for a directory in the utl_file_dir
> list, and a file name, validates the directory using
> a utl_file call, and then deletes the file).
>
> --
> Jonathan Lewis
> http://www.jlcomp.demon.co.uk
>
> Now running 3-day intensive seminars
> http://www.jlcomp.demon.co.uk/seminar.html
>
> Host to The Co-Operative Oracle Users' FAQ
> http://www.jlcomp.demon.co.uk/faq/ind_faq.html
>
> Author of:
> Practical Oracle 8i: Building Efficient Databases
>
> George Barbour wrote in message <3c553cdb$1_at_pull.gecm.com>...
> >Looking at the procedure, strikes me that it is possibly dangerous in the
> >wrong hands.
> >George Barbour.
> >"Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote in message
> >news:1012155772.16744.0.nnrp-02.9e984b29_at_news.demon.co.uk...
> >>
> >> In 8.1, there is an undocumented procedure in package
> >> dbms_backup_restore called "deletefile", as in:
> >>
> >> execute dbms_backup_restore.deletefile('/tmp/temp.txt')
> >>
> >> Check $ORACLE_HOME/rdbms/admin/dbmsbkrs.sql
> >> before trying it.
> >>
.. or the old gem
begin
for i in ( select name from v$datafile ) loop
dbms_backup_restore.deletefile(i.name);
end loop;
end;
:-)
-- ============================== Connor McDonald http://www.oracledba.co.uk "Some days you're the pigeon, some days you're the statue..."Received on Mon Jan 28 2002 - 16:52:15 CST