How to create/delete files from filesystem using PL/SQL ? UTL_FILE?

Greetings,
I will start by explaining what i intend to do.
I have an application made in APEX. This application will have among other purposes the managment of pdf files which will reside in the filesystem.
I have questioned the person in charge to keep the pdf files in the database and not in the filesystem but without success.
So the pdf files reside in the filesystem and there is a record in a database table about them. A table keeps all info about the pdf, their location , size and name, creation date etc.
The APEX application will have a mecanism to allow the deletion of the pdf files if an administrator decides.
So it should be possible for an administrator to schedule the deletion of all pdf files whoe creation date is older than 2008 for example
So, how can i achieve that?
After some research i foudn about the UTL_FILE package which seems to have it takes to perform the task in issue.
My idea was to have a script in the operating system which runs nightly and reads a file containing all file names of the pdf to be erased.
The file which contains the names of the pdfs to be erased will be generated by the database a few minutes before.
If there are no pds files to be erased than the file containing the names will simply be empty
Are there any other viable solutions out there?
And as for opening/creating the file withn the pdf names, i use:
UTL_FILE.FOPEN (
location IN VARCHAR2,
filename IN VARCHAR2,
open_mode IN VARCHAR2,
max_linesize IN BINARY_INTEGER)
RETURN file_type;
And as for writing lines (a pdf name per line ), i use;
UTL_FILE.PUT_LINE (
file IN FILE_TYPE,
buffer IN VARCHAR2,
autoflush IN BOOLEAN DEFAULT FALSE);
is there a better solution?
thanks all.
-> My Homepage <-
Edited by: Igor Carrasco on Apr 14, 2009 3:11 PM
Edited by: Igor Carrasco on Apr 14, 2009 3:12 PM

Greetings,
I have read that link above, some questions still though.
I will provide some more information.
-First the database is in a windows server.
The windows server has a virtual drive mounted as z:\ <-- this points to a directory in virtual machine, i can manually access/create/delete files manually,i tested.
-Second utl_file_dir is defined as * , in t that enough to cover mounted drives? ( i can't change the init.ora and reboot the db right now :( gotta wait.. )
Do i explicitly have to define utfl_file_dir = z: ?
-Third haven't had the chance to test it on linux or any other operating system, assuming a virtual unit is mounted successfully and that the issues above are solved i should be able to operate on any mounted drive whatever the os, right?
Best regards

Similar Messages

  • My start up disk is full.  How do I delete files from this?

    My air is saying my start up disk is full.  How do I delete files from it?  Is there a specific location I'm supposed to delete from, or is it just general files from everywhere--email, etc.

    For information about the Other category in the Storage display, see this support article. If the Storage display seems to be inaccurate, try rebuilding the Spotlight index.
    Empty the Trash if you haven't already done so. If you use iPhoto, empty its internal Trash first:
    iPhoto ▹ Empty Trash
    Do the same in other applications, such as Aperture, that have an internal Trash feature. Then restart the computer. That will temporarily free up some space.
    According to Apple documentation, you need at least 9 GB of available space on the startup volume (as shown in the Finder Info window) for normal operation. You also need enough space left over to allow for growth of the data. There is little or no performance advantage to having more available space than the minimum Apple recommends. Available storage space that you'll never use is wasted space.
    When Time Machine backs up a portable Mac, some of the free space will be used to make local snapshots, which are backup copies of recently deleted files. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown as  Backups. The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself. If you followed bad advice to disable local snapshots by running a shell command, you may have ended up with a lot of data in the Other category. Ask for instructions in that case.
    See this support article for some simple ways to free up storage space.
    You can more effectively use a tool such as OmniDiskSweeper (ODS) or GrandPerspective (GP) to explore the volume and find out what's taking up the space. You can also delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one. Note that ODS only works with OS X 10.8 or later. If you're running an older OS version, use GP.
    Deleting files inside an iPhoto or Aperture library will corrupt the library. Any changes to a photo library must be made from within the application that created it. The same goes for Mail files.
    Proceed further only if the problem isn't solved by the above steps.
    ODS or GP can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    If you have more than one user account, make sure you're logged in as an administrator. The administrator account is the one that was created automatically when you first set up the computer.
    Install the app you downloaded in the Applications folder as usual. Quit it if it's running.
    Triple-click anywhere in the corresponding line of text below on this page to select it, then copy the selected text to the Clipboard by pressing the key combination command-C:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    sudo /Applications/GrandPerspective.app/Contents/MacOS/GrandPerspective
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing command-V. You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The application window will open, eventually showing all files in all folders, sorted by size. It may take a few minutes for the app to finish scanning.
    I don't recommend that you make a habit of doing this. Don't delete anything as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means. When in doubt, leave it alone or ask for guidance.
    When you're done with the app, quit it and also quit Terminal.

  • Where can I find the Start up disk and how can I delete file from it.

    where can I find the Start up disk on theMac Book Air?
    How can I delete files from it?

    The startup disk is the internal SSD in your MBA.  You may delete files by draging the file  to Trash (or clicking on them and then execute COMMAND+Delete).  Then empty Trash.
    Ciao.

  • How do you delete file from time machine back up?

    How do you delete file from time machine back up?

    This from Apple KB Article  If Time Machine is not in your Dock, you can enter Time Machine from the Menu Bar or System Preferences.
    Deleting data from a Time Machine backup
    To delete all backups of one or more items from a Time Machine backup, follow these steps:
    Click the Time Machine icon on your Dock to enter the Time Machine restore interface.
    Click on the item you would like to delete. Command-click to select multiple items.
    Control-click (or right click) the highlighted item(s) and select "Delete All Backups of..." from the contextual menu, or select "Delete all backups of..." from the Action Item menu.
    Authenticate with an administrator password when prompted.

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to create chord charts from midi using logic pro x

    How to create chord charts from midi using logic pro x

    Depending on what you mean by Chord charts (Tabs?)
    Use the Score.......
    http://help.apple.com/logicpro/mac/10/#lgcpf755d649

  • HT1338 how do i delete files from my start up?

    how do i delete files from my startup?

    rastos wrote:
    how do i delete files from my startup?
    Do you mean your Accounts system preferences login items or something else?  For login items select an item and click the minus to delete it from the list.  Other "startup" processes need to be deleted from other specific places.  So you need to be more specific about what you are talking about.

  • HT5920 how do i delete files from my start up disk

    how do i delete files from start up disk

    If you do not need the files any longer, you can Drag them to the "Trash", then "Finder -> Empty Trash".  Once you empty the trash you cannot get them back.
    Or are you talking about something else.  If so, then please provide more details.

  • How to create dll file from c code to use in compactrio 9004 RT controller

    Hi.
    I am using Compactrio 9004 Real time controller and i am new to this. I have a C code and i want to use this with the RT controller.I red that that can be done by creating a dll file and can be called in labview.Can any body expalin how to create a DLL from the c code and be used with this RT controlelr?
    Regards,
    Vishnu

    vishnu123 wrote:
    Hi,
    Earlier in this forum itself in cRIO 900x controllers will run Pharlap and run C/C++ code compiled into .dll files.Can you please tell how to transfer the created DLL to RT controller memory throght FTP?
    Thanks and regards,
    Vishnu
    There is another KB article about this for Pharlap based controllers. And you are right the earlier CompactRIO controllers were Pharlap based. Basically for a deployed application to work, you need to put the DLL through FTP in "/ni-rt/system". If you deploy it directly from the project everything will be loaded into memory through the project environment itself including directly dependable DLLs, (but of course won't survive a power cycle).
    I hope you are aware that while Windows DLLs can work on Pharlap OS they by no means will do so always. The Pharlap OS has not a fully featured Windows API. Also you need to be careful which version of Visual C you are going to use depending on the Pharlap OS version, since the VC runtime DLLs already present on the controller will need to be the same as the ones your Visual C environment likes to link in. Recent Pharlap OS versions use the msvcr71.dll. It's very possible that those runtime libraries can't just simply be copied from a normal Windows installation but might have been recompiled by NI specifically for their controller targets.
    So to avoid problems it's a good idea to make sure your DLL uses the same runtime library DLL or make your DLL to include the static MS runtime.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-05-2008 09:51 AM
    Message Edited by rolfk on 02-05-2008 09:53 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How can I delete files from My Mac Book Pro safely to create more space?

    Hi,
    I need to delete files from my Mac Book Pro and I am not sure how to do it safely without affecting my computers drivers or operations.
    In my Finder - All Files Section there are certain files in the Preview, marked as "PNG Image", Window Image, GIF image, XLM. when I look at them they seem scripted or sections of an image. How do I know which files are safe to remove
    I seem to find a lot of duplicated files - is there a way of stopping this from happening?
    Thanks from a little frustrated Mac Book user.

    Welcome to Apple Support Communities
    Transfer them to an external disk formatted in "MS-DOS (FAT)" with Disk Utility > http://pondini.org/OSX/DU1.html
    If you have the pictures in iPhoto, choose them with the Command key, go to File menu (on the menu bar) > Export, and copy them to the external disk. Then, connect your external disk to the PC and move them.
    If you have the pictures in Finder, steps are the same, but in this case, you will have to drag the pictures you chose to the external disk that you can find in the Finder sidebar, under "Devices"

  • How do I delete files from a portable hard drive

    I've been backing up my MacBook Pro on an external portable hard drive. I need to delete some but not all the files from that portable hard drive permanently. When I highlight them and click to move them to Trash I get a message telling me this cannot be done because they are Read Only files? How do I go about it. I am required by work to delete them off this hard drive. Do I have to reformat the hard drive? If so how do I go about it?

    You can easily delete files from a Time Machine Backup:
    Click the Time Machine icon in the Dock.If the Time Machine icon isn’t in the Dock, look for Time Machine in the Applications folder.
    Use the arrows or the timeline along the right side of your screen to browse through the backups Time Machine created.The windows behave just like Finder windows, so you can open folders, click items in the sidebar, and use the search field in the upper-right corner of the window.
    When you find the item you want to delete, select it, and then open the Action menu (looks like a gear) and choose Delete All Backups for the item.

  • How to permanently delete files from trash?

    I usually see TV series online. Every time I visit to the website, it automatically downloads a Mac_Installer file to my Downloads folder. I delete the file without opening it and secure empty the trash. When I visit the website again, the same file is downloaded to my Downloads folder, and the "previous deleted file" from the trash can reappears on it. How to solve this matter? My computer is a MacBook Pro and is running OS X Mavericks.
    Thanks.

    Try erasing free space using Disk Utility.
    Erase free disk space
    When you delete files in Mac OS X, your Mac deletes the information used to access the deleted files but doesn't physically remove them. Although the space used by the deleted files appears as free space, the deleted files remain on the disk until new files are written over them. As a result, these files can be recovered. Erasing free space does not delete any other files on your disk besides the ones that you already deleted.
    After the drive is connected, launch the Disk Utility application in any of the following ways:
    Type the first few letters of its name into Spotlight. Select it from the results.
    Go Finder > Applications > Utilities > Disk Utility
    Go Launchpad > Utilities > Disk Utility
    Once you are in the Disk Utility app, select the disk or partition you would like to erase from the left.
    Select the Erase tab.
    Choose the Erase Free Space button.
    Use the Slider to choose how many times you would like to write over the free space.
    Select Erase Free Space.
    Note: After this process starts, you can cancel it at any time without harming any of your data. You might see a message stating that you are running out of disk space. This is normal and to be expected. You can ignore this message.
    When the process is complete, you should have the same amount of free space. If you do not have the same amount of free space, try restarting the computer.
    I hope I helped.
    Austin

  • How to create xml file from original

    I have this complicated xml and I want to search through it and make a new xml with only element I find that match. what is the best way to do this? the file
    is about 6mb and I want to read the whole file easily..should i load to database table and create a file from table? I have found issues reading the file..
    - <ArrayOfJobClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <JobClass>
    - <Triggers>
    - <TriggerClass>
    <ExpireActionType>Delete</ExpireActionType>
    <ExpireType>DateTime</ExpireType>
    <TriggerType>TimeType</TriggerType>
    - <TTime>
    <TimeTriggerType>Custom</TimeTriggerType>
    <IntervalType>Daily</IntervalType>
    <SpecificType>Days</SpecificType>
    <FirstLastType>First</FirstLastType>
    <IntervalValue>1</IntervalValue>
    <FirstLastWeekDay>Monday</FirstLastWeekDay>
    <InitDate>2009-05-04T14:17:05.40625-07:00</InitDate>
    - <IntervalDays>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>

    You can load it in the database in an XMLType table (Object-Relational or Binary XML storage), use XQuery on the XML content and then write back the result to a file.
    Or, you might just use an external processor (XSLT or XQuery).
    If you want to stay in the Oracle world, you can use :
    - For XSLT : $ORACLE_HOME/bin/oraxsl (it's a wrapper for the java XSLT engine)
    - For XQuery : the java XQuery API
    Personally, I sometimes use the Saxon XSLT and XQuery processor, quite efficient.
    Here's a simplistic example with oraxsl utility :
    emp.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <emps>
      <emp id="7369">
        <name>SMITH</name>
        <job>CLERK</job>
        <salary>800</salary>
      </emp>
      <emp id="7499">
        <name>ALLEN</name>
        <job>SALESMAN</job>
        <salary>1600</salary>
      </emp>
      <emp id="7521">
        <name>WARD</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>
      <emp id="7566">
        <name>JONES</name>
        <job>MANAGER</job>
        <salary>2975</salary>
      </emp>
      <emp id="7654">
        <name>MARTIN</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>
    </emps>
    emp.xsl
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="text()"/>
    <xsl:template match="emps/emp[job='SALESMAN']">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet>Applying the transformation to search and extract all "salesmen" :
    D:\ORACLE\test>%ORACLE_HOME%\bin\oraxsl emp.xml emp.xsl result.xml
    D:\ORACLE\test>type result.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <emp id="7499">
        <name>ALLEN</name>
        <job>SALESMAN</job>
        <salary>1600</salary>
      </emp><emp id="7521">
        <name>WARD</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp><emp id="7654">
        <name>MARTIN</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>

  • How do you delete files from iCloud WITHOUT having them deleted from devices?

    I need to delete files from iCloud WITHOUT having those files deleted from all my devices.  How do I do that?

    Just got off the phone with Apple customer service.  It seems there is no around this problem.  Once you use iCloud, you're screwed. The day you decide you don't want to have certain files store in iCloud, but you still want the files accessible on your computer, you have to spend valuable time copying/hiding a set of files on each device, and then re-setting up those same files in each device they way they should be once you delete them out of iCloud.  Same thing if you decide to cancel your lCloud account. 
    No software should have the ability to hijack your data this way.   

  • How do i delete files from adobe reader?

    How do I delete files that I do not want to view again from adobe reader?

    You want to delete the actual PDF files, or just the entries in the Recent Documents list?
    If it's the files, delete them from where they are stored on your local disk.
    If it's the Recent Documents list, that depends on your operating system.

Maybe you are looking for

  • Two VLANs on one switch port?

    Currently we have the following Cat 4003 with VLAN trunking turned on to multiple switches. Each port in those exterior switches is assigned to a vlan(we have about 60 different vlans). What I would like to do is on those exterior switches have two v

  • How to display elapsed/current time of a song in Actionscript.

    Hi I have a question on how I can make my code display a total time for a song from a media player I created with Actionscript 3.0, using XML to load the song track. This is my current function which I have done and I am unsure on what the problem is

  • IWeb blog pages versus TypePad, Blogger / Blogspot

    Hello bloggers, I want to start a blog to share my thoughts, ideas and photo snapshots. My question is: should I do that with iWeb and my dot Mac account, or use one of the on-line services like Blogger.com? What are the pros an cons of those two wor

  • ALV tab strip tree and container

    Hi Gurus, i have a requirement , in which a list of records are displayed as tree ALV at output and when user clicks on any of the records then in the bottom of the screen , it should display its item detials as tab strip in the same screen ( i mean

  • How often does icloud sync calendars?

    Have  PC running Windows7, and iPhone5 and an iPad Mini (not sure what generation but I just bought it a few weeks ago).  I have all three devices set up with iCloud, but my calendar doesn't seem to be synching.  What's the issue?