DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: utl_file

  1. #1
    Join Date
    Nov 2002


    Hi guys,

    I am using utl_file.fremove to remove some files from the OS side.
    To say it simple it just creates 2 temp tables, one with the archivelog listing and one with the datafile listing.

    Then I wrote a little sql query that compares the archivelog dates to the datafiles dates en gives a list of the archivelogs that can be deleted.

    The problem is with the loop part.
    I make a cursor of above query and then make a loop.
    The part which gives an error is:

    end loop;

    The DIRECTORY is the directory pointing to the archivelog directory on the OS. The ... is the error. When I use the cursor parameter like 'filename' it searches for the string filename and not for the name coming out of the cursor.
    When I do filename without the quotes it says I have a code fault.

    So either way he doesn't seem to recognize the file part. Is there any way around it? or am I doing something wrong?
    The problem in short is the fact the cursor works but the utl_file part doesn't recognize the filename.

    The directory is right, I can do a utl_file fremove without a loop, just single OS file remove with the hard coded filename.
    So I have rights etc.

    Anyone have any ideas.

  2. #2
    Join Date
    Nov 2002
    Geneva Switzerland
    Where is the beginning of the loop? Like: "For x In () Loop"?

    I think it should look something like:
    For x In (Select filename . . . . ) Loop
    End Loop;

    It would help if you posted code & error msg.

  3. #3
    Join Date
    Nov 2002

    Thank you very much, I just tried the loop you suggested and it works.
    It seems I was trying to do a normal loop with a cursor which doesn't seem to work with it.

    I then moved the select in the loop syntax like you showed and it worked.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width