UTL FILE Search Fucnction

Hi All,
i need a requirement i have a directory . inside i have lot of .dat files. i want to create a file using UTL_FILE concept. but before creating the file i have to check the directory
the file name already exists or not???
How to do that in UTL_FILE???
Can anyone suggest me in this??
Thanks in Advance
Cheers,
Shan

DECLARE
  vInHandle  utl_file.file_type;
BEGIN
  vInHandle := utl_file.fopen('ORALOAD', 'test.txt', 'R');
  IF utl_file.is_open(vInHandle) THEN
    dbms_output.put_line('The File exists');
  Else
    dbms_output.put_line('The File dosen't exists');
  END IF;
END fopen;Note that you must declare in database directory object called "ORALOAD":
CREATE OR REPLACE DIRECTORY ORALOAD AS '/usr/users/oracle/';

Similar Messages

  • Open PDF's in new window in document library when using "Find a file" search

    I need to be able to open PDF's in a new window from a document library when using the "Find a file" search built into the document library "All documents" view. I currently have the following javascript on the page:
    _spBodyOnLoadFunctionNames.push("setTargetBlank()");
    function setTargetBlank()
    { $("a[href$='.pdf']").removeAttr('onclick').attr("target", "_blank");
    This works great when going to the document library and navigating through the folders then clicking on a link.
    The problem is when someone goes to the document library then uses the "Find a file" search and then they click on a link. The "Find a file" search does not do a postback (reload) of the page, therefore my javascript to find the PDF links
    and make them open in a new window does not run for the links on the page.
    I have read the following article but this does not seem to offer a solution that will work in this situation for SharePoint 2013 (Office 365): http://social.technet.microsoft.com/Forums/sharepoint/en-US/7ad3224c-3165-47ae-95bc-4f3928e2f9a8/opening-document-library-pdf-in-a-new-window-sharepoint-2013?forum=sharepointgeneral
    I suppose the idea solution would be to somehow tap into the event that is fired when using "Find a file" search to run my javascript and update the links for the search results.
    Can anyone offer any solutions to this issue?

    Hi,
    According to your description, my understanding is that you want to open PDF files in a new window from a document library when using the "Find a file" search.
    As you said, the "Find a file" search does not do a postback (reload) of the page, therefore JavaScript to find the PDF links and make them open in a new window does not run for the links on the page.
    I recommend to use JS link to achieve the goal. Create a JavaScript override file and upload the JavaScript file to the Master Page Gallery, and then set the JS Link property of the document library web part to point to the JavaScript file.
    Here are some links about the JS link in SharePoint 2013 for you to take a look:
    http://www.idubbs.com/blog/2012/js-link-for-sharepoint-2013-web-partsa-quick-functional-primer/
    http://www.learningsharepoint.com/2013/04/13/sharepoint-2013-js-link-tutorial/
    http://zimmergren.net/technical/sp-2013-using-the-spfield-jslink-property-to-change-the-way-your-field-is-rendered-in-sharepoint-2013
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • How can i create  excel sheet with multiple tabs using utl file?

    how can i create excel sheet with multiple tabs using utl file?
    any one help me?

    Jaggy,
    I gave you the most suitable answer on your own thread yesterday
    Re: How to Generating Excel workbook with multiple worksheets

  • Is there a way on maxdb to force netbackup to use different initSID.utl fil

    (This thread refers to a question that was posted to a blog and where the proper location to handle it is this forum)
    Is there a way on maxdb to force netbackup to use different initSID.utl files ? I have try to do it with different bsi.env file . But if i start the backup it keep on asking for the default bsi.env file in /sapdb/data/wrk/SID directory . I have set the variable BSI.ENV to the new file but it looks like it ignore it. Its on a sun solaris operating system
    Due to security reasons the DBM server process does no longer inherit environment variables from its caller, e.g. dbmcli.
    see PTS 1155045, as especially in the area of external backup tools inheriting environment settings seem to be rather common.
    Idea is to add BSI_ENV to the dbm.cfg file with a command like:
      dbmcli -d ... -u ... dbm_configset BSI_ENV
    For further information please refer to this documentation section
    or for Backint also here 
    Best regards
    Jörg

    Hi Jörg,
    hmmm. I'd guess there are some problem with for which user the environment variables have been defined...
    Anyhow, usually it's easier not to use the environment variables but to provide the dbm-server it's own runtime variables via dbm_configset.
    Check the old thread archive_stage and archive_stage_repeat to different NSR_POOLs for an example application of this.
    regards,
    Lars

  • Bug in Multi-File Search and Replace in RH6?

    I'm using the 6.0 trial, and one thing I want to be able to
    do is to replace the variables I put in using JavaScript with the
    new feature variables in 6.0. So, I went in to multi-file search
    and replace, and searched for:
    <script
    language=JavaScript>document.write(varProduct)</script>
    I copied this code directly from a topic, and pasted it into
    the Search tool.
    I don't even care whether I can successfully copy the code
    from my new variable for use as the replacement text; I'd be happy
    if the multi-file search would simply find all occurrences of my
    original code so I don't miss any during conversion to 6.0.
    It keeps coming up as not found, and this concerns me
    greatly. Has anyone else experienced this? Is it a known bug? Does
    anyone have a workaround?
    Thanks!

    Hi robowriter
    I'm assuming you are using the wondrous little applet known
    as Multi-File Find and Replace.
    Unfortunately, this little beastie is like a cat. It
    frequently has a fussy tummy and loves to hork up furballs. Well,
    not exactly. Really what it does is fail to properly handle
    anything with a line break. So you need a tool that does do this.
    Fortunately, one exists! It is called FAR (Find And Replace). Oddly
    enough, it was also written by a fellow Microsoft Help MVP named
    Rob Chandler. (Rob lives in Australia)
    You can download a trial version of FAR from the FAR page.
    Click here to visit
    the FAR page
    Cheers... Rick

  • Utl file in report

    hai all,
    I have to develop a report using utl file.
    Like when the report is given a parameter some four columns are displayed, at the same time i want to write the data in a text file in the server path /usr/tmp.
    used formula column for utl file open , putline etc.
    While running i am getting the error
    REP-1401:'cf_1formula', Fatal PL/SQL error occured.
    ORA-00600:internal error code , argument :[kghal02],[oxo],[],[],[],[],[]
    can anyone suggest me a solution for this or there is any other solution for using utl file in oracle reports.
    I am in urgent need of it.
    Thamks and regards,
    aaditya

    Make sure that the directory you use with UTL_FILE is writable. For example, if you use /abc/xyz, then both directories (abc and xyz) should be writable.

  • Cretaion of UTL.File in Oracle 10G and directory entry in Ora.ini file

    Hi,
    Kindly advise me if:
    (!) we can create a directory and log file in this directory on some other server instead of creating it in the file system of the server where the Oracle 10G database is residing?
    Created directory in Oracle using create or replace directory command.
    My package will be creating a log file using UTL.File in the above directory.
    I want to create this directory on some other server to save my log file/s. Is this possible?
    (2) Also, let me know in Oracle 10G, do we need to add the directory entry (mention above in #1) in the Ora.ini file on the Oracle 10G server?

    Hi,
    1) utl_dir are different from directory object
    2) you cannot create directory on remote server and there is no need to write directory entry on oracle init file (not ini..)
    Acr

  • Server 2008r2 and windows 7 pro slow to no networkshare file searching and file access (green progress bar)

    we are running a windows server 2008r2 sp1 domain controller and a 3com gigabit switch to which 7 windows 7 pro computers are connected. We are only using the windows server to distribute a few printers and as a network share (z drive).
    we are storing all files (word documents only) centrally on the server (z share), and files are accessed and written to the z share.
    Problem is that file access from the z share on the windows 7 client computers is at best buggy. we are able to browse the z-share, but as soon as we want to search the z-share for files (f.i. use file explorer with "content: memorandum") the green
    progress bar shows and no search is performed. something like alphabetically sorting a directory on map/file name on the z-share also shows a green bar with no sorting. manually going to the files works.
    One thing i noticed, sometimes not all files that one user created and stored on the server is visible and can be found by another user. I prefer to disable all offline file caching setting, because that feature is not used. no files should be made accessible
    offline. i don't know where to change that on the server side. 
    I am reluctant to experiment on the server end (2008r2 sp1), so i tried a few suggested solutions on the client end (windows 7 client)
    I tried disabling offline file caching
    i tried properties (z share) ==> advanced and map optimizing and several options there
    i tried disabling the smbv2 protocol and disabling the smbv1 protocol (using
    sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi command etc. posted by microsoft)
    i tried disabling windows defender
    i tried accessing the z share via ip and server name (the share is mapped via its servername, e.g. dennis-dc1\share). still the same
    file searching on the clients c drive ('own harddrive') works much better, file searching on the server also works.
    any suggestions or solutions that i can test on the client side, as mentioned i am reluctant to change something on the server side. if a solutions works, i prefer to change it on the server side.

    Hi,
    The issue could be due to windows indexing service taking long time in sorting and searching in mapped drives. Please try the steps belwo to disable windows indexing service or search service on the windows 7 client to resolve the issue.
    You can click on Start and select Control Panel, click on
    Programs and Features, go into the Turn Windows Features on or off section Scroll down the list and uncheck the box next to Indexing Service or Windows Search.
    Best Regards,
    Mandy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Error using UTL File

    Hi,
    I am using UTL file to export data to an external file and getting an error which i am unable to reslove... Can anyone help me with this
    SQL> create or replace
    2 procedure MEXICO_NAFTA_CERTIFICATE_EXT (
    3 f_org_id varchar2,
    4 f_customer_nbr_base varchar2,
    5 f_customer_nbr_sufx varchar2,
    6 f_year VARCHAR2)
    7 is
    8 output_file utl_file.file_type;
    9 o_filename VARCHAR2(50):= 'MEXICO_NAFTA_CERTIFICATE_EXT.txt';
    10 o_DataDir CONSTANT VARCHAR2 (30) := '/d014/oradata/temp';
    11 v_CERTIFICATE_NBR fta.SAP_CERTIFICATES_EXTRACT_VIEW.CERTIFICATE_NBR%type;
    12 v_PART171 fta.SAP_CERTIFICATES_EXTRACT_VIEW.PART171%type;
    13 v_INACTIVE_IND fta.SAP_CERTIFICATES_EXTRACT_VIEW.INACTIVE_IND%type;
    14 v_HTS_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.HTS_CDE%type;
    15 v_ORIGINATING_IND fta.SAP_CERTIFICATES_EXTRACT_VIEW.ORIGINATING_IND%type;
    16 v_ISO_COUNTRY_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.ISO_COUNTRY_CDE%type;
    17 v_BASIS_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.BASIS_CDE%type;
    18 v_PRODUCER_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.PRODUCER_CDE%type;
    19 v_CERT_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.CERT_CDE%type;
    20 v_REGIONAL_VALUE_CONTENT_CDE fta.SAP_CERTIFICATES_EXTRACT_VIEW.REGIONAL_VALUE_CONTENT_CDE%type;
    21 v_PART_NBR fta.SAP_CERTIFICATES_EXTRACT_VIEW.PART_NBR%type;
    22 v_EFFECTIVE_DATE fta.SAP_CERTIFICATES_EXTRACT_VIEW.EFFECTIVE_DATE%type;
    23 v_EFFECTIVE_FROM_DATE fta.SAP_CERTIFICATES_EXTRACT_VIEW.EFFECTIVE_FROM_DATE%type;
    24 v_EFFECTIVE_TO_DATE fta.SAP_CERTIFICATES_EXTRACT_VIEW.EFFECTIVE_TO_DATE%type;
    25 v_TRANSACTION_DATE fta.SAP_CERTIFICATES_EXTRACT_VIEW.TRANSACTION_DATE%type;
    26
    27
    28 CURSOR Cert_ext IS select certificate_nbr ,
    29 part171,
    30 inactive_ind,
    31 hts_cde,
    32 originating_ind,
    33 iso_country_cde,
    34 basis_cde,
    35 producer_cde,
    36 cert_cde,
    37 regional_value_content_cde,
    38 part_nbr,
    39 effective_date,
    40 effective_from_date,
    41 effective_to_date,
    42 transaction_date
    43 from fta.SAP_CERTIFICATES_EXTRACT_VIEW
    44 where org_id= f_org_id AND
    45 customer_nbr_base= f_customer_nbr_base AND
    46 customer_nbr_sufx = f_customer_nbr_sufx AND
    47 to_char(effective_from_date, 'yy') = f_year AND
    48 to_char(effective_to_date, 'yy') = f_year;
    49
    50 begin
    51
    52 output_File := UTL_FILE.FOPEN (o_DataDir, o_FileName, 'w');
    53
    54 OPEN Cert_ext;
    55 loop
    56
    57 fetch Cert_ext into v_CERTIFICATE_NBR ,
    58 v_PART171 ,
    59 v_INACTIVE_IND,
    60 v_HTS_CDE ,
    61 v_ORIGINATING_IND ,
    62 v_ISO_COUNTRY_CDE ,
    63 v_BASIS_CDE ,
    64 v_PRODUCER_CDE ,
    65 v_CERT_CDE ,
    66 v_REGIONAL_VALUE_CONTENT_CDE ,
    67 v_PART_NBR,
    68 v_effective_date,
    69 v_effective_from_date,
    70 v_effective_to_date,
    71 v_transaction_date ;
    72
    73 UTL_FILE.PUT_LINE (output_File, v_CERTIFICATE_NBR || ' '||
    74 v_PART171 || ' '||
    75 v_INACTIVE_IND || ' '||
    76 v_HTS_CDE || ' '||
    77 v_ORIGINATING_IND || ' '||
    78 v_ISO_COUNTRY_CDE || ' '||
    79 v_BASIS_CDE || ' '||
    80 v_PRODUCER_CDE || ' '||
    81 v_CERT_CDE || ' '||
    82 v_REGIONAL_VALUE_CONTENT_CDE || ' '||
    83 v_PART_NBR || ' '||
    84 to_char(v_EFFECTIVE_DATE, 'mm-dd-yy') || ' '||
    85 to_char(v_EFFECTIVE_FROM_DATE, 'mm-dd-yy') || ' '||
    86 to_char(v_EFFECTIVE_TO_DATE, 'mm-dd-yy') || ' '||
    87 to_char(v_TRANSACTION_DATE, 'mm-dd-yy'));
    88
    89 UTL_FILE.FCLOSE (output_File);
    90 DBMS_OUTPUT.PUT_LINE ('Data Extracted');
    91 end loop;
    92 close Cert_ext;
    93 END MEXICO_NAFTA_CERTIFICATE_EXT;
    94 /
    Procedure created.
    SQL> declare
    2 begin
    3 MEXICO_NAFTA_CERTIFICATE_EXT('0048', '00254101', '11', '03');
    4 end;
    5 /
    Data Extracted
    declare
    ERROR at line 1:
    ORA-29282: invalid file ID
    ORA-06512: at "SYS.UTL_FILE", line 774
    ORA-06512: at "FTA_SOURCE.MEXICO_NAFTA_CERTIFICATE_EXT", line 72
    ORA-06512: at line 3

    what is the datatype of your column org_id for the table fta.SAP_CERTIFICATES_EXTRACT_VIEW? also try to put this exceptions to see what might be the exact cause of the error.
      EXCEPTION
        WHEN utl_file.invalid_mode THEN
          RAISE_APPLICATION_ERROR (-20051, 'Invalid Mode Parameter');
        WHEN utl_file.invalid_path THEN
          RAISE_APPLICATION_ERROR (-20052, 'Invalid File Location');
        WHEN utl_file.invalid_filehandle THEN
          RAISE_APPLICATION_ERROR (-20053, 'Invalid Filehandle');
        WHEN utl_file.invalid_operation THEN
          RAISE_APPLICATION_ERROR (-20054, 'Invalid Operation');
        WHEN utl_file.read_error THEN
          RAISE_APPLICATION_ERROR (-20055, 'Read Error');
        WHEN utl_file.internal_error THEN
          RAISE_APPLICATION_ERROR (-20057, 'Internal Error');
        WHEN utl_file.charsetmismatch THEN
          RAISE_APPLICATION_ERROR (-20058, 'Opened With FOPEN_NCHAR But Later I/O Inconsistent');
        WHEN utl_file.file_open THEN
          RAISE_APPLICATION_ERROR (-20059, 'File Already Opened');
        WHEN utl_file.invalid_maxlinesize THEN
          RAISE_APPLICATION_ERROR(-20060,'Line Size Exceeds 32K');
        WHEN utl_file.invalid_filename THEN
          RAISE_APPLICATION_ERROR (-20061, 'Invalid File Name');
        WHEN utl_file.access_denied THEN
          RAISE_APPLICATION_ERROR (-20062, 'File Access Denied By');
        WHEN utl_file.invalid_offset THEN
          RAISE_APPLICATION_ERROR (-20063,'FSEEK Param Less Than 0');
        WHEN others THEN
          RAISE_APPLICATION_ERROR (-20099, 'Unknown UTL_FILE Error');

  • Getting INVALID_OPERATION  while using UTL file

    Hi,
    I have a procedure which makes different UTL files i.e data file, error file and log file for a Purchase order. These 3 sets of files are made for every purchase order.
    So suppose in a cursor i find that there are 10 Purchase orders to process, then it should create 30 UTL files 10 sets of 3 files.
    But when i run this procedure, after processing 3 PO's i.e after creating 9 files i get INVALID_OPERATION error.
    So lets say i have 10 PO's 1 to 10 , i run for first time PO 1,2 and 3 utl files are created and then i get error. Then when i run it again processes PO number 4 to 6 and then again error...
    So i want to know is there any restriction on number of UTL files you can create in a single procedure. i want urgent help, appreciate ur quick replies on this matter.
    thanks,
    Dipin

    Hi,
    There could be several reasons for this...
    1. In inti ora file, what utl file directory was specified? is it 'C:\PLXML\DBDOM'? if not check.
    2. Do u have C:\PLXML\DBDOM\Testfile.txt in your directory?
    3. If you have above file in that directory and you have opened that file for writing purpose, close that.
    Ur program looks ok. Also, dbms_output.put_line will display 255 charcters only(at least in 7.3).
    Koti.
    null

  • Problem with UTL FILE COPY

    Hi,
    I am facing one small problem in UTL FILE COPY package. We have an automated scheduled batch process. As a daily batch process it moves the files from one folder to other. During movement, it first copies the file from source folder to destination folder using FILE COPY package and then removes the file using FILE REMOVE package from the source folder.
    Few cases are found that the file when files are copied they are copied as 0 bytes in destination folder but the source file had 1 MB file size. The interesting part is I am unable to replicate the issue. Means when i try to run once again the package its working properly and files are copied with correct size. This kind is issue is occuring very rarely though as once in month but the question is why FILE_COPY package is not working properly sometimes.. I am unable to understand.
    Thanks a lot for going through this. Any suggestions.
    Regards,
    Ashish

    Anyhow make sure that the copy will start after the full generation of files.
    You can think like a spool file generation with huge data. In that case initially spool file available with 0 byte only. After finish of query only it shows its actual size.

  • Problem with utl file

    Hi to all,
    I have tried the UTL file concept as per the oracle documentation
    I have created a directory name read_flat_file and granted read, write permission to the whm user. I am trying to executing the below code as in Oracle Documentation, but I am getting this below error.
    DECLARE
    V1 VARCHAR2(32767);
    F1 UTL_FILE.FILE_TYPE;
    BEGIN
    F1 := UTL_FILE.FOPEN('READ_FLAT_FILE','HMI PO','R',256);
    UTL_FILE.GET_LINE(F1,V1,32767);
    UTL_FILE.FCLOSE(F1);
    END;
    Error I am getting is
    F1 UTL_FILE.FILE_TYPE;
    ERROR at line 3:
    ORA-06550: line 3, column 4:
    PLS-00201: identifier 'UTL_FILE' must be declared
    ORA-06550: line 3, column 4:
    PL/SQL: Item ignored
    ORA-06550: line 5, column 1:
    PLS-00320: the declaration of the type of this expression is incomplete or
    malformed
    ORA-06550: line 5, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 6, column 19:
    PLS-00320: the declaration of the type of this expression is incomplete or
    malformed
    ORA-06550: line 6, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 7, column 17:
    PLS-00320: the declaration of the type of this expression is incomplete or
    malformed
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored
    I tried this code from system user but I got the same error.
    When I am trying the same code with the SYS User I got this error.
    declare
    ERROR at line 1:
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 475
    ORA-29283: invalid file operation
    ORA-06512: at line 5
    I dont understand the UTL_FILE package is granted to PUBLIC role by default.
    In sys user the handler is throwing the error perfectly that invalid file operation. then why this is not occuring with other users.
    Please let me know why this is happening
    Thanks and Regards,
    Vijay

    Hi Vijay,
    There are two problems here...
    The first is that your user doesn't appear to have execute privs on the procedure. As you say, it is usually granted to public, but it doesn't look like it is for you. Check the privileges with:
    select *
    from dba_tab_privs
    where table_name like 'UTL_FILE'
    This will list who has permissions on the package. If you get nothing, grant execute to either public or to your user:
    grant execute on sys.utl_file to <user/public>;
    The second problem is a syntax error on line 5 of your procedure. Remove the ',256' bit - it shouldn't be there.
    F1 := UTL_FILE.FOPEN('READ_FLAT_FILE','HMI PO','R');
    Cheers,
    Andy Barry
    http://www.shutdownabort.com

  • Issue with utl file

    Hi,
    I am using UTL file to export records from table with fixed delimiter to a text file.
    It works fine except that I see an additional character @ at the end of the file in the last line.
    Can anyone let me know why are we getting this and how can we delete it..
    Thaks in advance..

    I assume, as you are saying you can see the file ok in notepad/wordpad that you are creating a text file.
    So a) what are you using to view the file in unix and b) how did you transfer the file to unix?
    When you transfer files from Windows/DOS based operating systems to unix based operating systems you have to be aware that Windows uses a CR/LF pair of characters to terminate a line (a 'newline') and unix just uses a single LF character (character 10 in the ascii table) to terminate a line.  So when you transfer the files you need to convert the CR/LF pairs into just LF characters.
    Typically this is done if you transfer the files using FTP and specify the 'mode' to be ASCII rather than BINARY.
    c:\>ftp testserver
    Connected to testserver.mycompany.com.
    220 sunny2 FTP server ready.
    User (testserver.mycompany.com:(none)): myuser
    331 Password required for myuser.
    Password:
    230 User myuser logged in.
    ftp> ascii
    200 Type set to A.
    ftp>
    This tells the FTP software that you are transferring text files and that it needs to convert newline characters, if necessary, when transferring between Windows and Unix operating systems.
    And for reference, if it's not a text file, then you must transfer in BINARY mode to ensure the files remain byte for byte the same...
    ftp> bin
    200 Type set to I.
    ftp>
    If you don't transfer text files, between different operating systems, in ASCII mode, then those files will either be missing characters or have additional characters that aren't wanted.

  • File search problems in Leopard

    I MUCH preferred the older (pre-leopard) finder file search application(NOT spotlight). I was able to type what I was looking for and manually select the drives and servers I wanted searched in the finder window. The results came in, broken down by kind (image, document, pdf, folder) in icon driven sub-categories. Spotlight and the clumsy new search application are a MAJOR setback for me. This is the first bad move I have had to call Apple on.

    You can only select the whole computer, or ONE and only one specific location to search (this is a reduction in functionality from the implementation of Spotlight in Tiger). Thus if I wanted to search my Data drive only, not my startup or backup drive, I would navigate in the Finder to the Data drive, then hit Command-F, then click on "Data" rather than the default "This Mac" (which is always selected, which is ridiculous--when you bring up search with a Command-F you want to search in that place, if you wanted to search everywhere you would use the Spotlight menu bar function). The nearest you can come to grouping things is to put the results window into List view (Command-2 or select from List from the View option in the Finder window's toolbar), then click the Kind column. You might find my little essay on Leopard's Spotlight helpful:
    http://www.pinkmutant.com/articles/Leopard/leospot.html
    You might also wish to tell Apple about how you feel:
    http://www.apple.com/feedback/macosx.html/
    The more complaints they receive, the more likely things will improve.
    Francine
    Francine
    Schwieder

  • UTL file exception handling oracle 11g

    We use oracle 11g
    We use UTL file and exception handling in many place. Thanks in advance.
    We have many utl program and we are writing same exception handling code ,copy and paste .
    It is possible to create new UTL exception procedure and call it.
    I am not sure how to write generic UTL exception procedure and reuse the same.
    I am learning oracle etl files method.
    Please advise.
    sample program 1 :
    DECLARE
    fileHandler UTL_FILE.FILE_TYPE;
    BEGIN
    fileHandler := UTL_FILE.FOPEN('test_dir', 'test_file.txt', 'W');
    UTL_FILE.PUTF(fileHandler, 'Writing TO a file\n');
    UTL_FILE.FCLOSE(fileHandler);
    EXCEPTION
    when utl_file.invalid_path then
    raise_application_error(-20001,
    'INVALID_PATH: File location or filename was invalid.');
    when utl_file.invalid_mode then
    raise_application_error(-20002,
    'INVALID_MODE: The open_mode parameter in FOPEN was invalid.');
    when utl_file.invalid_filehandle then
    raise_application_error(-20002,
    'INVALID_FILEHANDLE: The file handle was invalid.');
    when utl_file.invalid_operation then
    raise_application_error(-20003,
    'INVALID_OPERATION: The file could not be opened or operated on as requested.');
    when utl_file.read_error then
    raise_application_error(-20004,
    'READ_ERROR: An operating system error occurred during the read operation.');
    when utl_file.write_error then
    raise_application_error(-20005,
    'WRITE_ERROR: An operating system error occurred during the write operation.');
    when utl_file.internal_error then
    raise_application_error(-20006,
    'INTERNAL_ERROR: An unspecified error in PL/SQL.');
    when utl_file.invalid_filename then
    raise_application_error(-20010, 'The filename parameter is invalid.');
    WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN(fileHandler ) THEN
    UTL_FILE.FCLOSE (fileHandler );
    END IF;
    RAISE;
    END;
    How to write generic procedure of utl exception handling ?
    please advise.
    create or replace procedure sp_utl_exception
    begin
    when utl_file.invalid_path then
    raise_application_error(-20001,
    'INVALID_PATH: File location or filename was invalid.');
    when utl_file.invalid_mode then
    raise_application_error(-20002,
    'INVALID_MODE: The open_mode parameter in FOPEN was invalid.');
    when utl_file.invalid_filehandle then
    raise_application_error(-20002,
    'INVALID_FILEHANDLE: The file handle was invalid.');
    when utl_file.invalid_operation then
    raise_application_error(-20003,
    'INVALID_OPERATION: The file could not be opened or operated on as requested.');
    when utl_file.read_error then
    raise_application_error(-20004,
    'READ_ERROR: An operating system error occurred during the read operation.');
    when utl_file.write_error then
    raise_application_error(-20005,
    'WRITE_ERROR: An operating system error occurred during the write operation.');
    when utl_file.internal_error then
    raise_application_error(-20006,
    'INTERNAL_ERROR: An unspecified error in PL/SQL.');
    when utl_file.invalid_filename then
    raise_application_error(-20010, 'The filename parameter is invalid.');
    WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN(fileHandler ) THEN
    UTL_FILE.FCLOSE (fileHandler );
    END IF;
    RAISE;
    end;

    Mahesh Kaila wrote:
    Hello,
    Common procedure to log exception in log file
    create or replace procedure sp_utl_exception (log_dir varchar2, log_file varchar2, exception_msg varchar2)
    is
    hnd_file   UTL_FILE.file_type;
    begin
    hnd_file := UTL_FILE.fopen (log_dir, log_file, 'A');
    UTL_FILE.put_line (hnd_file, exception_msg);
    UTL_FILE.fclose (hnd_file);
    exception
    when others
    then
    raise;
    end;
    Very poor implementation.
    a) Absolutely no need for that exception handler in there. It should be removed.
    b) As it's a procedure for logging exceptions relating to UTL_FILE, it would seem error prone to be logging the errors with UTL_FILE. For example, what is it supposed to do if the exception is raised because of lack of disk space in those file locations? How is it going to write out the exception with the disk full? Also, if the exception handler is used by multiple processes, then only 1 process at a time can access the log file to write it's exceptions, so it doesn't scale well. Better logging is done by having an autonomous transaction procedure that writes log/trace messages to dedicated table(s). That also means that the logs etc. can be viewed, as appropriate, from any client using SQL (either manually or through a application written to view logs etc.), rather than requiring physical/remote access to the server o/s to go and view the contents of the file, which in itself could lock the file and prevent any process from writing further logs whilst it's being used.

Maybe you are looking for

  • How can I re-install the app?

    Indesign CC was trashed. Creative Cloud Shows app as "up to date". How can I re-install the app?

  • What is non-Software Unit

    Hi All,    In "Netweaver 2004s" version for "XI" in SLD: 1. What is "Non-SAP Sotware Unit" ? 2. How to add existing Business system to another product? regards, Khaja

  • How do I schedule an autosys job to run monthly?

    Please what command do I use to schedule an autosys job to run monthly? And how do I use this command?

  • How BPEL human task becomes to state 'Withdrawn'

    All, what causes human task to go to 'Withdrawn' state. The reason i know is deleting associated bpel process. Are there any other events which causes this ? Regards, Praveen

  • SAP Knowledge Acceleration

    Hi experts, I downloaded from SAP partners website some files SAP Knowledge Acceleration. When i open them, sometimes the file asks me the following: Click Next to continue with the course, or select an activity from the list. When i click on an acti