How to find if file exists in UTL_FILE_DIR

One of my programs need to check if a particular file exists. How do I know if a file exists or not. Basically I have to append data to an existin file or open a new file if the file doesn't exists.
I'm using utl_file for writin the files
Please provide your valuable suggestion.
Thanks

If you are using an older version, you can also use DBMS_LOB.FILEEXISTS instead of utl_file.fgetattr, like so:
DECLARE
  v_bfile       BFILE := BFILENAME ('MY_DIR', 'my_report.txt');
  v_file_handle UTL_FILE.FILE_TYPE;
BEGIN
  IF (DBMS_LOB.FILEEXISTS (v_bfile ) = 1) THEN
    v_file_handle := UTL_FILE.FOPEN ('MY_DIR', 'my_report.txt', 'a');
    UTL_FILE.PUT_LINE (v_file_handle, 'continuing report');
  ELSE
    v_file_handle := UTL_FILE.FOPEN ('MY_DIR', 'my_report.txt', 'w');
    UTL_FILE.PUT_LINE (v_file_handle, 'starting report');
  END IF;
  UTL_FILE.FCLOSE (v_file_handle);
END;

Similar Messages

  • How to find log files in Sun soalries....

    How to find log files in the SUN Solaries Os if there is any.....
    i am new to SUN Solaries Admin Can some one refer me a good book for me on sun solaries
    Thankq

    A reasonable method would be
    cat /etc/syslog.conf
    .. at least it would show you where syslog send its logs.
    .7/M.

  • How to find the File name using the FTP Adapter

    hi all,
    how to find the File name using the FTP Adapter with BPEL.
    Regards

    Found the solution for this.
    First In the mediator's routing rule use assign property $in.property.jca.file.FileName to $out.property.jca.file.FileName
    In the BPEL's receive activity go to the properties tab and get the property to a BPEL variable. That should do it.
    Thanks for the posts

  • Question about how javac finds referenced files.

    Hi
    I am just beginning to learn Java and have got some questions related to packages.
    I have two classes:
    MyClass.java
    package pkg;
    public class MyClass {
         public void prn(int x){
         System.out.println("Integer: "+x);
    Test.java
    import pkg.*;
    public class Test{
         public static void main(String[] args){
              MyClass obj=new MyClass();
              obj.prn(2);
    Directory structure
    /root/ jprog/MyClass.java
    /root/ jprog/Test.java
    Executing the following sequence of commands gives me:
    # ls
    MyClass.java Test.java
    # javac -d . MyClass.java
    # ls
    MyClass.java Test.java pkg/
    # cd pkg
    # ls
    MyClass.class -----compiles.
    # cd ..
    # javac Test.java
    Test.java:5: cannot access MyClass
    bad class file: ./MyClass.java
    file does not contain class MyClass
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    MyClass obj=new MyClass();
    ^
    1 error
    Now after reading another thread on this forum I came to know that the compiler finds the
    MyClass.java in the wrong package. Using verbose option with javac shows this.
    So I move it to some other directory and everything works.
    # mv MyClass.java /root
    # ls
    Test.java pkg/
    # javac Test.java
    # java Test
    Integer: 2
    Now the question begins:
    Suppose we go back to how the files were arranged before I moved the MyClass.java file and
    I change the Test.java file by adding
    package pkg2;
    statement to it.
    Now everything compiles
    # ls
    MyClass.java Test.java ---I have deleted pkg and .class files
    # cat Test.java
    package pkg2;
    import pkg.*;
    public class Test{
    public static void main(String[] args){
    MyClass obj=new MyClass();
    obj.prn(2);
    # cat MyClass.java
    package pkg;
    public class MyClass {
    public void prn(int x){
    System.out.println("Integer: "+x);
    # javac -d . MyClass.java
    # javac -d . Test.java
    # ls
    MyClass.java Test.java pkg/ pkg2/
    # java pkg2.Test
    Integer: 2
    Why isn't the MyClass.java file causing any problems now?
    Using the verbose option with javac shows that the compiler goes straight for the pkg/MyClass.class.
    My readings of Core Java Horstmann tell me that the compiler always looks in the current directory. javac documentation also doesn't help. I know that the documentation recommends that the source file locations should match the package statements.
    I'm just trying to learn how javac finds referenced files.
    Any help??
    Thanks a load in advance.

    I know that the
    documentation recommends that the source file
    locations should match the package statements.This is not merely a recommendation, it is a requirement.
    Both javac and java find classes by traversing the classpath. The classpath should contain directories (or jar files) that correspond to the top of a (part of the) package hierarchy.
    For example, if the Java code for your class is in a file C:\src\pkg\MyClass.java, and MyClass.java declares the class to be in package pkg, the classpath should contain C:\src. Classes are then found by transforming their package declaration into a directory structure.
    Please note that javac works on files, not classes. Therefore it is necessary to specify the full filenames of the files you want to compile, even if you have specified the classpath. By default, javac will put compiled class files in the same location as their sources, so the classpath for the java command should also contain C:\src.
    The exception to the rule is when all classes for the program are in the default package (i.e., they do NOT contain a package statement). In that case, it is possible for javac (and I believe java as well) to find all classes in the current directory, so it will "just work".
    You can specify the classpath using the -cp parameter to both javac and java.
    Hope this helps.

  • How to find .pld files version in Oracle apps

    Hi,
    How to find .pld file version in Oracle apps using unix command or any other way.
    Regards

    Connect to the forms server.
    In the $AU_TOP/resource directory run the following...
    strings -a <NAMEOFFILE>.plx | grep '$Header'
    For example...
    To find the .pld version of INVAMCAP.plx I would run this on the forms server.
    cd $AU_TOP/resource
    strings -a INVAMCAP.plx | grep '$Header'
    This will return the .pld version.
    Hope this helps!
    Jen

  • How to find duplicate files in Finder with Automator or Apple ScriptEditor

    Can anyone tell me how to find duplicate files in Finder with Automator or Apple ScriptEditor.

    D'oh!  It's actually fairly easy - I just right clicked on the file, Get Info, Artwork tab, then dragged the picture to the desktop, from where I can do what I like with it.  Never mind, nothing to see here, carry on.

  • How to find the file that delete from time capsule?

    How to find the file that delete from time capsule?

    I mean I saved JPEG file in Time capsule and unfortunately delete the file. Can I get it back
    IF.... .no other backups have occured since you deleted the file, you might be able to retrieve it using an application like Disk Warrior. It's about $100 as I recall, and there are no guarantees that it will work.
    DiskWarrior 4 - The Disk Utility for Mac  Disk Repair, Mac Directory ...
    Any of the free or low priced utilities that you might see or try will not be able to retrieve a deleted file from a Time Capsule.
    If any backups have occured since you deleted the file, the deleted file has almost certainly been overwritten. No way to retrieve it in that case.

  • How to find lost files from Iphone without back up

    How to find lost files from iPhone without back up?

    If you don't have a back up, there's no where to restore them from.

  • TS1362 My iTunes has stopped playing - it will not progress. I have updated iTunes, and can't figure out how to find any plug-ins - can't figure out how to find hidden files on the iMac Finder.

    How do I find hidden files on my iMac? My iTunes has stopped playing music and videos - the playbar does not progress, and it may be that there is a plug-in that is stopping it. How do I fix it?

    Well, it sort of solved my problem. Now every time I start a lecture with sound, there is no sound, but the slides advance. If I go back to iTunes and turn on a cd, it plays the sound. If I then go back to the lecture, the sound goes on. So each time I start a slide show with sound, I have to turn on iTunes. How can I fix this?

  • How to find the file versions in Oracle applications?

    I am requested by the Oracle applications team to check the versions of the following files.
    POXWPA6B.pls-115.68.11510.6
    POXWPA7B.pls-115.38.11510.7
    I have zero experience in managing oracle applications. I would appreciate if some one could let me know how to find the versions in my server. My DB and the applications are in Linux servers.
    Also would appreciate if some one could provide pointers to handling Application DBA scenario like this.
    Thanks,
    -- Bala

    Here is an example:
    1) /u01/oracle/testappl/po/11.5.0/patch/115/sql>strings -a POXWPA7B.pls | grep -i Header
    /* $Header: POXWPA7B.pls 115.3 1999/11/10 16:10:34 pkm ship       $ */
    /* $Header: POXWPA7B.pls 115.3 1999/11/10 16:10:34 pkm ship       $ */
    2) /u01/oracle/testappl/po/11.5.0/patch/115/sql>adident Header POXWPA7B.pls
    POXWPA7B.pls:
    $Header POXWPA7B.pls 115.3 1999/11/10 16:10:34 pkm ship       $
    $Header POXWPA7B.pls 115.3 1999/11/10 16:10:34 pkm ship       $

  • How to find trace file error in form

    hai all,
    i have big problem in my form in apps i open the form one error is ocuured,
    i got the trace file and check the error,
    PARSE ERROR #82:len=2903 dep=0 uid=173 oct=3 lid=173 tim=4265689973879 err=904 this is the trace file error meassage,
    how to find this error in form and also this is occured one select statement,how to find this select statement where can be used in form,
    i have one button ,when ever i press the button this error is ocuured,i check this button pl/sql procedure code but in this code not using that sql statement,
    if any one know to find the sql statement through trace file.
    plz give the replay as soon as possible.
    thank's

    The newest SQL Developer can converts the trace to readable format too, I'm not shure if you see the sql statement related to the error then.
    It seems you get ORA-00904 which says you use an invalid coumn in a dml statement.
    Normally such error should pop up in message - do you overwrite the message handling or use exception handling in you form which block this message?
    Easiest way to find this is to compile the form against the target database.
    If this does not give an error, you should check, if you use dynamic sql statements which are wrong.
    If you call database routines from your form, than this could be the errro cause too.

  • How to find LST file ,which is used in forms 6i

    hi all,
    can anyone tell me how to find the LST file in a form, i am calling one main LST file ,which fires when iwordpad pops up.. and when the wprdpad pops up ,it is saying that data not found in the data source ...
    so wanted to check that LST file , in my form .
    usually where ,in which trigger we will mention the LST file ... if anyone have this idea , please let me know .
    cos in that LST file ,we will map the feilds which is used in both the wordpad and in my source tables.

    See http://www.experts-exchange.com/Databases/Oracle/Q_20060296.html for an example of ways to find & open a file.

  • HT1199 My iTunes music list all have the exclamation point.  I do not know how to find the files to restore the music.  Any advice?

    All the songs in my iTunes have the exclamation point.  I do not know how to find location of the music...any suggestions?

    Ok, your music could be in one of a coupel formats, MP3 or, more likely, Apples AAC format, which has a m4a prefix.  Open Finder.  Hold Command and press F, this will open a search window in the top of Finder.  Type mp3 here, let it search.  If it finds your music files, double tap on one and "open Enclosing Folder"  That should show you where they are at.  If nothing is found, try searching m4a instead.  One of the two should show you where your music is.

  • How to find artwork files in finder

    Some of the artwork in my library is not as good as I would like it to be.  Most of them are OK, but a few are not, for example Andromeda season 1, downloaded from iTunes, the artwork is squashed.  I'd like to open the artwork file in Pixelmator and fix it, but how do I find the file?  I've gone to Home -> Music -> iTunes -> Album Artwork, and found lots of nested folders and some .itc files with incomprehensible names.

    D'oh!  It's actually fairly easy - I just right clicked on the file, Get Info, Artwork tab, then dragged the picture to the desktop, from where I can do what I like with it.  Never mind, nothing to see here, carry on.

  • How to find locked files and unlocked them???

    Having trouble for snxing itunes i need to find locked files but i dont know how and unlocked them so that i can sync again..

    When i connect my ipod into my computer "unknown error occured(-54)" is keep appearing thats why i cant see my library in my ipod.. And i think locked items caused this.. I open once another program that for browsing files to for iphones and ipods and after that the unknown error keep appearing and some of my musics are in grey i cant even delete it

Maybe you are looking for

  • Rule to avoid sending email to the wrong recipient based on content

    Hi guys, My customer has had bad experience with the auto-complete feature in Outlook in the past, and now that he's getting Office 365 Enterprise, he wants to know if there is a way to block any outgoing mail intended for another company. We would b

  • Combine rows?

    I'm trying to combine two rows under one column. using: oracle 10g Here is my code select     cr.report_id as report_id,     cr.report_name as report_name,     ei.info as info from SPSS.WEB_CLIENT_REPORTS_NFL CR,  spss.web_report_extra_info_nfl EI wh

  • Import Process without BCD value

    Dear All, Normally in an Import scenario,7 duties will be there(CVD,ECessCVD,Hig EcessCVD,BCD,EcessBCD,Hig EcessBCD,Spl Addl duty). We fill the 7 values while doing Customs MIRO and the MIRO number will be given while doing MIGO which adopt the value

  • Best practice for packing Flash Lite

    Hello there! I want to package my Flash Lite 2.0 app and I've looked into these ways to do it: 1) SWF2SIS 2) SWF2GO 3) Widget - http://wiki.forum.nokia.com/index.php/How_to_package_Flash_content_in_a_Widget What's your experience from these and are t

  • How to create survey form that is static?

    Hello, I have a 5 question form I created. I'm using drop down boxes with a Likert Effectiveness scale from 1-5. I'd like to add a "Total Effectiveness" field to the bottom and calculate this based on the drop down box selections. How can I do this?