Having a problem to recognize the file using the utl_file package...

Hello

I use utl_file utility to read the CSV file, utl_file.fopen function is useed to open the file. The fopen function has three input parameters, the second parameter is the name of the file. My problem is that I need to read file on a daily basis. The file name will be like:-DDMMYYYYHHMISS. Last six characters are for the hour minute second generational file. If the name has only DDMMYYYY then I can give the name of file as TO_CHAR(SYADATE,'DDMMYYYY'), for an individual the same date throughout the day. But the hours, minutes and seconds will be time when the file is generated, it can be different for different days. In this case how can I normalize the value for the filename parameter in the function fopen.

Thanks in advance.

Similar to the jeenesh solution:

declare
 fexists boolean;
 fname varchar2(20) := to_char(trunc(sysdate),'DDMMRRRR');
 ......
begin
 . ...
   for i in 1..24*3600 loop
     utl_file.fgetattr(location,filename || to_char(to_date(i-1,'sssss'),'HHMISS'),fexists,file_length,block_size);
     if fexists then fname = fname || to_char(to_date(i-1,'sssss'),'HHMISS'); exit; end
  end loop;
.... --- now you can open the file with above found filename

end;
/

Tags: Database

Similar Questions

  • I'm having a problem to install the flash player on my Win 7 PC

    Same question as many other peple.  IE just won't work downloads and installs well but does not work

    I'm having a problem to install the flash player on my Win 7 PC

    Hello

    Have you followed the steps in troubleshooting posted here, Activate for Internet Explorer?

    --

    Maria

  • Anyone had problems, create a pdf file using MS Word 2016 on an operating system of Windows 10?

    Hello!

    WINDOWS 10 MS WORD 2016 SYSTEM REQUIREMENTS TECHNICAL REQUIREMENTS ABOVE X 3

    I just bought this Acrobat DC program, but it seems very flaky. It takes knowledge of the documents, but half the time it will not address the great Documents of Ms. The mine starts but then corrupts the Word document (Acrobat DC).

    Hi mike aylen,.

    What is the version of the dowry of the DC Acrobat installed on your system?

    Try to 'Repair installation' under the Help menu.

    If the problem persists, then uninstall Acrobat using Download Adobe Reader and Acrobat cleaning - Adobe Labs tool cleaning tool and restart your system.

    Then re-install it from here: Download Adobe Acrobat products. Standard, Pro | DC, XI, X and check if this solves the problem.

    Kind regards

    Meenakshi

  • run the UTL_FILE package

    declare

    utl_file.file_type F1.
    Start

    F1: is UTL_FILE.fopen ('UTL1', 'example1.txt', 'w');.

    UTL_FILE.put_line (F1, 'hello');
    UTL_FILE.put_line (F1, 'welcome');
    UTL_FILE.put_line (f1, "this is the example to use utl_file package system");
    end;

    After the execution of this file is created with the specified name in the specified location.
    but the text is not inserted into the file.
    What is the reason and how can I solve this problem?

    You forgot to fclose

  • having a problem with parsing the XML file

    Hi all
    I am trying to get data from XML file
    I want to only 4-5 values in this XML file
    Here is an example of XML file
    -< transaction >
    -< TransCtx >
    > < pAMETranType > IRCVACAPPROVAL < / pAMETranType >
    > < / TransCtx >
    > < / transaction >

    I want to add value and to store this value in table
    I'm here, I want to "IRCVACAPPROVAL".
    the tag
    < pAMETranType >

    for this purpose


    I created a procedure

    CREATE OR REPLACE PROCEDURE insert_xml_emps (p_directory in varchar2,
    > p_filename in varchar2)
    (> vtableName in varchar2) as
    > v_filelocator BFILE.
    > v_cloblocator CLOB.
    > l_ctx DBMS_XMLSTORE. CTXTYPE;
    > l_rows NUMBER;
    > v_amount_to_load NUMBER;
    > dest_offset NUMBER: = 1;
    > offset NUMBER: = 1;
    > lang_context NUMBER: = DBMS_LOB. DEFAULT_LANG_CTX;
    > WARNING NUMBER;
    > START
    > dbms_lob.createtemporary (v_cloblocator, true);
    > v_filelocator: = bfilename (p_directory, p_filename);
    > dbms_lob.open (v_filelocator, dbms_lob.file_readonly);
    > v_amount_to_load: = DBMS_LOB.getlength (v_filelocator);
    >-* this line is changed * -.
    > DBMS_LOB. LOADCLOBFROMFILE (v_cloblocator,
    > v_filelocator.
    > v_amount_to_load.
    > dest_offset.
    > offset.
    > 0,
    > lang_context.
    (> warning);
    >
    > l_ctx: = DBMS_XMLSTORE.newContext (vTableName);
    > DBMS_XMLSTORE.setRowTag (l_ctx, 'TRANSACTION');
    > DBMS_XMLSTORE.setRowTag (l_ctx, 'TRANSCTX');
    >-clear the update settings
    > DBMS_XMLStore.clearUpdateColumnList (l_ctx);
    >-set the columns to update a list of values
    > DBMS_XMLStore.setUpdateColumn (l_ctx, 'PAMETRANTYPE');
    >
    >-now insert the doc.
    > l_rows: = DBMS_XMLSTORE.insertxml (l_ctx, v_cloblocator);
    > DBMS_XMLSTORE.closeContext (l_ctx);
    > dbms_output.put_line(l_rows ||) "... inserted rows. ») ;
    > dbms_lob.close (v_filelocator);
    > DBMS_LOB. FREETEMPORARY (v_cloblocator);
    > END;

    I also have on the table who get this value

    whenever I call that created the procedure
    it sometime gives an error or sometime run correctly but store null in the table


    But when I change the XML file
    as
    When convert all lowercase letters in the capital then it works fine

    Is tehre to other ways to parse the XML file with no change in the XML file?

    Did you use the same test (with the exception of file name and directory) case?

    What I posted is a copy/paste direct SQL * Plus, and it works on version 11.2.0.1.

  • Having a problem in Windows 7 when using Skype

    Hello world

    My name is Steven Lash, I lived in San Diego in the United States. I have been using Windows 7 for the past 6 years, all software and applications work properly except Skype, for these 2-3 weeks, I was faced with problem on my Skype. I don't understand what is the real problem. I did my best to solve this problem, as I've uninstalled Skype and update it to the latest version, but still the problem is the same. Now, I'm going to share exactly the problem I used, while I started my laptop Skype has successfully loaded whenever I was answering to anyone to contact on Skype, it displays the message do not answer and the circle is the continuous treatment and here I got the error on my Skype screen. http://prntscr.com/beleyg, please check any suggestions really appreciated.

    Steven Lash

    Hi Steven,

    Sorry for the inconvenience caused.

    If please go to http://support.microsoft.com/and click the Skype link. We have a dedicated team to help you with problems with Skype.

    I hope this helps.

  • Hi I need to read the data in vaiables local file delimited using the utl_file package «»


    Hi all

    I want to read data from a .csv file which is ',' delimited in a local variable that is different from a plsql stored procedure so that I can insert into the table.

    I use this way to read data...

    --------------------------------------------------------------------------------

    -get the position of ',' (comma) in csv file

    --------------------------------------------------------------------------------

    l_c1: = INSTR (l_in_file, ',', 1, 1);

    l_c2: = INSTR (l_in_file, ',', 1, 2);

    l_c3: = INSTR (l_in_file, ',', 1, 3);

    l_c4: = INSTR (l_in_file, ',', 1, 4);

    l_c5: = INSTR (l_in_file, ',', 1, 5);

    l_c6: = INSTR (l_in_file, ',', 1, 6);

    l_c7: = INSTR (l_in_file, ',', 1, 7);

    l_c8: = INSTR (l_in_file, ',', 1, 8);

    l_c9: = INSTR (l_in_file, ',', 1, 9);

    l_c10: = INSTR (l_in_file, ',', 1, 10);

    --------------------------------------------------------------------------------
    -pull data into local variables
    --------------------------------------------------------------------------------
    l_0003: = SUBSTR (l_in_file, l_c2 + 1, l_c3-(l_c2 + 1));

    l_0004: = SUBSTR (l_in_file, l_c3 + 1, l_c4-(l_c3 + 1));

    l_0005: = SUBSTR (l_in_file, l_c4 + 1, l_c5-(l_c4 + 1));

    l_0006: = SUBSTR (l_in_file, l_c5 + 1, l_c6-(l_c5 + 1));

    l_0007: = SUBSTR (l_in_file, l_c6 + 1, l_c7-(l_c6 + 1));
    l_0007: = To_Char (To_Date (l_bdate_0007, "mm/dd/yyyy '"), 'yyyy-mm-dd');

    l_0008: = SUBSTR (l_in_file, l_c7 + 1, l_c8-(l_c7 + 1));

    l_0009: = SUBSTR (l_in_file, l_c8 + 1, l_c9-(l_c8 + 1));

    l_0016: = SUBSTR (l_in_file, l_c9 + 1, l_c10-(l_c9 + 1));
    l_0016: = To_Char (To_Date (l_eff_dt_0016, "mm/dd/yyyy '"), 'yyyy-mm-dd');

    I need to find an alternative way to reduce the length of the Code.

    Any Suggestion please!

    Hello

    Please see the query below...

    SELECT RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 1), ',') AS part_1

    , RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 2), ',') AS part_2

    , RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 3), ',') AS part_3

    , LTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ', [^,] *', 1, 3), ',') AS part_4

    DOUBLE;

  • Having a problem connecting to the internet with Workstation 6.5

    I have a problem with access to the internet on Windows Vista Business x 64 on VMware Workstation 6.5. My computer is Windows 7 professional 64-bit. I left everything default settings. On my host computer, I have my connection wireless connected to my router to get a IP through DHCP and it is connected and on the internet. I also have more than 2 connections, VMware Network Adapter VMnet1 VMnet 8 are listed as no access Internet under Access Type and are listed as unidentified network. On my guest OS I am connected via Nat and when I start first of all my virtual machine that my network card shows as connected with local and internet access but after 5 seconds it only local changes. My host uses a system of IP of 192.168.1.x and my guest operating system is using 192.168.19.x. I don't know where to start. I tried google and know disp. I hope I have not confused things by giving too much information that can be irrelevent and maybe omitted important things. Help, please. Thanks in advance.

    Check if the host firewall disabling resolves. Also (I know you use not packed, but check anyway) http://kb.vmware.com/kb/760

  • Having a problem with signing the cloud today

    This is what happens when I connect

    Capture.jpg

    Capture.jpg

    Hi JJMack,

    Please follow the steps mentioned below:

    Close the creative cloud application.

    Navigate to the OOBE folder.

    Windows: [system drive]: \Users\ [user name] \AppData\Local\Adobe\OOBE

    Mac OS: /Users/ [user name] / folder/Library/Application Support / Adobe / OOBE

    Delete the file opm.db.

    Launch the creative cloud.

    Let us know if this helps,

    -Pascal

  • I reformatted my computer and it starts great, but I'm having a problem connecting to the internet. Is there something to do to correct it?

    Internet is directly connected to the student of ethernet and plugged in right and it does not appear in the connections.

    Check Device Manager to make sure that the driver for your network card is installed.

    Click Start > run > type devmgmt.msc > click Ok. Scroll down and locate all of the items with a yellow! or! next to them. If one or the other of these symptoms appear after the brand and model of your computer.

  • Help about the utl_file package

    Hi all
    I'm new on utl_file

    I created a directory

    Create directory LOGDIR AS 'G:\logdir\ '.

    My dbuser with DBA privileges.

    Here is my code
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    BEGIN
      vInHandle := utl_file.fopen('LOGDIR', 'TEST.TXT', 'R');
    UTL_FILE.GET_LINE(vInHandle,vDATA,256);
     
    dbms_output.put_line(vDATA);
      
    END ;


    but when i run this code it gives me

    Error on line 0
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    vOutHandle ut

    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 475
    ORA-29283: invalid file operation
    ORA-06512: at line 6
    Please help me

    This error indicates usually that there is a problem, see the file. Either the directory on the operating system permissions are incorrect for oracle to be able to see the file or the file does not exist or, if you are using a unix database server then the file names will be case-sensitive. I assume that your oracle server is not unix that you have specified a windows style path in your directory. (You obviously realize that UTL_FILE can only access the database server file system and local client filesystems not?)

  • I'm having a problem on line when someone else uses the same router, error message: there is an IP address conflict

    Original title: I'm having a problem online when someone else uses the same router I have...

    I bought a new laptop with windows 7 premium. I connect to the internet through an external modem dsl and a wireless belkin n router. My daughter has an Android and uses the same connection... The problem is that we cannot not be online at the same time... If shes online using his android I can't connect using the laptop and if Im online using the laptop, she can't get online using his android... The error message indicates that there is a conflict of IP address... And sometimes says that there is a dns error... How can I fix this problem so that we can surf the net using the same connection?

    Hello

    Router is the gateway to the Internet, and it assigns the IP address for different devices. With the error message, you have so many IP address conflict, it seems that the IP address is not assigned correctly on the router.

    I suggest that you turn off all devices, reset the router and turn on the router. Once that is done turn the whole one and try to connect to the Internet.

    For assistance on this, you can contact your router manufacturer or Internet service provider.

    Hope the information is useful.

  • Problem with lines in Illustrator using the Wacom Tablet

    Hi all

    I have no idea why I'm having this problem in Illustrator. I use the small Intuos Pen Tablet (CTL-480), and my lines in illustrator is really strange. Even when I turn off the pressure in the brush settings, there is a gap in the line (it takes just one line of the same thickness). The Tablet works perfectly in Photoshop, but because I use the tablet to create art using plates (typography), it is easier and better for me to use illustrator. You are not sure that someone else had a similar problem or know maybe a setting I could change or try to fix it?

    I have attached a picture of the problem.

    Screen Shot 2016-05-06 at 7.58.21 PM.png

    Screen Shot 2016-05-06 at 6.46.21 AM.png

    Thank you for your help.

    This is a known issue.

    If all you want is a line single width, do not use brushes. Use the pencil tool and a simple blow

    If you apply a calligraphy brush, apply the effect zig - zag to it with a value of 0, then a setting of about 100 (turn on the preview to adjust)

  • Windows Media Player 12 and offset audio/video problem on most video files (.avi, .mkv)

    Hello

    This is the first time that I have a problem playing with windows media player 12.
    2 days I'm having this problem, most of the video files playback (IE great movies) are unstable and the video drags too and is only scratching sound coming from the speaker, while these files work fine on VLC, Real Player and WMC.
    Whatever the source of the files on hard drive or an external source, it just does not play it correctly how which he used to play everything.
    In addition, MP3 and other video files smaller in size are seem to be working on it.
    I would be very happy for your help!
    Concerning

    Hello
    1 did you change on your computer before this problem?
    You can follow the suggestions and then check.

    Method 1
    You can run the troubleshooting of Windows Media Player settings
    Open the troubleshooting Windows Media Player settings Troubleshooter
    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-settings-Troubleshooter

    Method 2
    You can update the latest codecs and then check.
    NOTE: WARNING OF THIRD PARTY SOFTWARE

    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk. :

    Codecs: Frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows7/codecs-frequently-asked-questions

     
  • problem with playing the clash of clans

    I'm having some problems while playing the clash of clans on my 2 mini ipad screen does not seem to meet sometimes as if it was some sort of delay so I have to tap several times in order to use a filter or throw the troops on the battlefield.

    Hi Trinitygr,

    Thanks for posting in the Community Support from Apple! I understand that you are having problems with your iPad screen while playing a game. I like to play games on my iPad and I don't see how this could be a nuisance. I'm happy to offer assistance.

    Are you only had this problem when using the app clash of Clans, or does it happen in all applications? I recommend to start by following the steps described in this article:
    If an application you have installed unexpectedly closes, unresponsive, or does not open

    Take care!

Maybe you are looking for

  • Unable to connect to the Outlook e-mail after that put 9.3.1 update

    I can't connect to Outlook e-mail after set 9.3.1 update. "Cannot get Mail. The connection to the server has failed. » I tried to delete the email account and add it again. The same problem. I know that this is a widespread problem now. When will thi

  • problem backup Time capsule

    It has been 29 days since the last backup from time machine of my imac 27 "and the mac pro to my time capsule. When I select the disk to use for the backup, after the display of connection to the disk 5 or 10 minutes later a messeage "wa there a prob

  • Office jet pro 8620: setting up scan to email on mac

    I was always able to scan from my printer to my email until the yeaterday when I received an error message that email and pin code do not match. I don't know how to reset as the technician must have put up when he helped me install the printer.

  • C5180: C5180 change to the previous version of the operating system in the drop-down dialog box

    I tried to fix the parse error: 4, [(0,12,80004005), (2,7,80040007), (3,7,0) error of scanning hp] and stumbled upon a fix in support of HP that says if the scanning functions work properly before an upgrade of the operating system to try to use the

  • vCloud connector - cannot copy VAPP vCloud Director to vSphere

    Evening,Try to copy a paralytic to vCloud Director on vCenter 5.5 5.6 using vCloud connector 2.7.The scenario:-vCloud Director fully configured with one Org, an Org vDC and a catalog.-The catalog is entirely filled, shared and published.-Org and cata