Appending date and time to file created in UTL_FILE

I am trying to create a log file of database (9i) updates using PL/SQL code and I am able to create a file using UTL_FILE utility and in file name I give name as 'log-'||sysdate||'.txt' and it successfully cerates log-22-NOV-05.txt file.
My problem is adding time to it. I declared a varibale ws_var1 and capture time in it by below statement.
select to_char(sysdate,"HH24:MM:SS') into ws_var from dual.
SO when I try to add this to file name as 'log-'||sysdate||'-'||ws_var1||'.txt' the file that gets created is just two number such as 02.txt, 34.txt etc.
I am not sure where the problem is but any help to create file name with date+time information is apperciated.
Thx

Why not just:
'log-'||TO_CHAR(sysdate, 'DD-MON-YYYY-HH24MISS')||'.txt'
SQL> select 'log-'||TO_CHAR(sysdate, 'DD-MON-YYYY-HH24MISS')||'.txt' from dual ;
'LOG-'||TO_CHAR(SYSDATE,'D
log-22-NOV-2005-170813.txt
1 row selected.
SQL>

Similar Messages

  • HOW: File handling - Date and time of file created/modified

    Hi all,
    Is there any way by which we can find out the date and time of the file created in operating system using file handling through PL/SQL.
    Eg:-
    I have a directory in which I am storing some files, and for a given file name I must know when that file was created, i mean date and time.
    Might be there is some simple way, please help out.
    regards
    CJ

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584#73995149457661
    Remember to get the correct privs (java privs) on the directory.
    Mette

  • The date and time of files created and saved are off

    I notice that under the date modified column, files that I have saved or updated are usually a day off. I checked the date and time in the system preferences and it is correct. is something wrong with the battery?

    Hi, paulmont -
    Be sure the Time Zone setting is correct.
    If you have time displayed as 12-hour (rather than 24-hour), be sure the AM/PM setting is correct. Having that wrong will displace the mod/create date/time recorded for a file by 12 hours, which will (at times) shift it to another day.
    If you use Classic, make sure the same settings are in Classic as well as in OSX, particularly the Time Zone setting. This is especially true for machines which can be and are booted into OS 9. The typical symptom for this being the cause is an offset of one or a few hours.

  • How to rename a flat file concatenating date and time the file name?

    I created a package where I run a first interface that uses a flat file from a server and load into a table in Teradata.
    After using the API OdiFtpPut, I used an FTP file and send to an outfit.
    Since this procedure will operate daily, I need at the time of FTP, get the concatenation destination file name, date and time of execution.
    What is the best practice for this?

    Using OdiFtpPut in the field where it informs the destination file name, instead of putting just the file name (lpn_pln.csv), I put as follows:
    - lp_pln_+<% = odiRef.getSysDate (ddMMyyyyhhmm ")%>+. csv
    For code example, today would record the name lp_pln310120111412.csv
    Anything you can add my msn ---> aluizs @ ig. com. br (no spaces)
    Edited by: andre_l_soares on 31/01/2011 08:16

  • Combine date and time fields to create datetime field

    I have a column that is Data type: Time and one that is Data type: Date.  I want to end up with one column that is Date type: Date/Time.  Seems like it should be easy.
    Thanks in advance for your help.

    You can combine the two columns using the Query Editor. Let's assume you have two columns loaded into the Query Editor. The first column has the time column, and the second one has the date, you can follow these steps to combine the two:
    Select the two columns.
    Go to "Transform" tab, and click the "Merge Columns" (See screenshot below).
    In the "Merge Columns" dialog select "Space" in the first dropdown menu, and type the new column name in the second control.
    Click "OK".
    Now you will see a new column in the Query Editor instead of the previous two columns.
    Right click the column header and select Change Type --> Date/Time.
    The new column will be converted into a Date/Time column.
    Merge Columns Dialog:

  • Create a folder with date and time

    hey yall. i'm working on a program to assign files to a created directory. for the sake of organization, i want to create a folder that is the date and time it was created. (ie c:\\new\\02-Jun-2008\\file.txt) i know i'm missing something. here's the code i have so far to create the folder:
    Format formatter;
    Date date = new Date();
    formatter = new SimpleDateFormat("dd-MMM-yy_hh:mmaaa");
    String s = formatter.format(date);
    String path = "C:\\new\\";
    String destination = path + s;
    File d = new File(destination);
    d.mkdirs();
    i know its trivial for any advanced user but im only a student and any advise or useful links are great. i'll keep searching in the meanwhile. thanx.

    got it myself. failed to remember NO : are allowed in windows. <sigh>

  • DataMart Interface - Date and time of the transferred data

    Hello,
    We have a requirement to build a datamart (cube to cube) between two BW systems, using deltas; this is OK and should not present any issue. However a further requirement has arisen, requiring to provide date and time of the created files to outbound systems. I have been looking to RS* and RO* tables for finding out the details of the delta queue.
    Table RSDMDELTA provides the Data Mart Delta Management: could this table be used to provide required details? Or are there any other relevant tables containing this info?
    Thanks&Regards,
    Begonia

    Hi,
    Thanks for your quick response. We are not using openhubs, but a direct cube to cube datamart - by generating the cube as exporting datasource.
    Is there any equivalent table in this case?
    Thanks&Regards,
    Begonia

  • Date and Time in Sender File Adapter Target Directory

    Hi there,
    is there a way of using Date and Time from XI to the Target Directory naming? To use variable substitution some fields of the message had to contain that date and time information, which is not our case.
    For filename you can use "add time stamp" option, but and for target directory?
    Thanks and regards,
    Henrique.

    > <i>Do you have further information on how to perform
    > this with shell commands?</i>
    > >> You need to write a shell script. This script will
    > add the date/time stamp into the folder in the target
    > system. This shell script is executed from the File
    > adapter. So once the file is written into the target
    > directory, then it will rename the directory.
    Hi there, Moorthy
    We've tried to write that shell script that you mentioned, but now we have a few doubts on how to make it create the proper directory.
    In the file adapter, my target directory is "/%var1%/%var2%/", where %var1% and %var2% are variable substitutions, referencing data which comes from the payload. Now, I need the shell script to append "/<Year>/<Month>/" in the target directory. But where to archive the script? If it stays in the root directory, than how to make it create "/<Year>/<Month>/" folders inside a directory which is variable (/%var1%/%var2%/)?
    Is there a way of passing %var1% and %var2% as parameters for the shell script?
    Thanks a lot,
    Henrique.

  • How to provide date and time stamp to the extracted file.

    I 'm downloading data from DB to Flat file using GUI_DOWLOAD. whenever it is executed it is creating with a file name.
    if i rerun the program the file is overwriting with the same name.
    now based on the requirement how many times i executed, that many times file should be individually created and should be added with date and time stamp.
    like
    if when i executed  at the very first time it should saved with filename, date and time.
    say "Address.txt 04/05/2007 07:55:10"
    When i executed it for second time it doesn't overwrite the file.
    it should create a new file.
    like "Address.txt 04/05/2007 07:59:20".
    Please guide me the way if possible code.
    Thanks in advance.

    Hi Vamsi,
                   Use FM 'F4_PROGRAM' to take file from the user .
    In this case user will enter the file name. u can append date & time to that file path.
    Refer this code.
    CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SY-REPID
          DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          FILE_NAME     = P_P_FILE.
    concatenate P_FILE '04/05/2007 07:59:20' into V_FILE.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_file
         filetype                        = 'ASC'
          write_field_separator           = 'X'
        TABLES
          data_tab                        = i_tab
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF sy-subrc = 0.
        MESSAGE i002.
      ENDIF.
    Reward points if helpful.
    Regards,
    Hemant.

  • Automatically creating data filename out of date and time information

    I read somewhere (in a book, here ?) about a programmer who never keyed in a data filename to save his data file. He just used the system date and time to create his filename. For example: now would be 20028141032.dat (2002, August 14, 10:32 am)
    I am looking to do something similar. I do want to add a spot of text after the date and time and save it as *.xls.
    This way when you have a long list of data files, if you sort by name, they are sequentially in order.
    Thanks for any help.
    Terry

    Hi Terry,
    You can use "Seconds to Date/Time" Funtion along with "File Dialog" Function to accomplish your task. You Unbundle the cluster from the "Seconds to Date/Time" with Year, Month, Day, Hour and Minute Information Convert and Append into One String. You Can add Pre or Post text to this String. Wire this to File Dialog Box and it will Pop up the Window With File Name in it as Default. Also the extemsion of the file name can be specified here. The User has Option to change this or accept this default name.
    I have attached an Example Vi to Illustrate this(LV6.1) Take a Look. To Use this Just Wire the Path Information to your Saving Functional VI. Also the Vi Checks if File Exists or Dialog Box is Cancelled. And You may Build Functionality for the
    se if you need them.
    Good Luck.
    Mache
    Good Luck!
    Mache
    Attachments:
    DateStamped_File_Name.vi ‏29 KB

  • How to load date and time from text file to oracle table through sqlloader

    hi friends
    i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
    this is my data in this path (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);the control file code in this path (c:\external\ctrl.ctl)
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>any help i greatly appreciated
    thanks
    Edited by: user10947262 on May 31, 2010 9:47 AM

    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)Try
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>
    That's not an error, you can see errors within log and bad files.

  • Inserting automatic file name, date and time in Illustrator CS3?

    hello all,
    is there an option in Illustrator where you could automatically insert inside your file the file name, date and time where it was last created or modified, etc.
    I found this option to exist in InDesign, but could not find the same menu in Illustrator. I am using CS3.
    help?
    thanks a bunch.

    Mario,
    would you please be so kind to include a reference on your site about the script? As far as I can see, the PutDateandTime.js you are providing here is a copy or a slightly modified copy of the original script that Wolfgang Reszel has provided on our site for about four years.
    It is okay that the script is available on your site, but please not without a reference. Thanks.

  • Date and Time in the flat file

    Hi All,
    I am trying to design a flow which will get data from a flat file. The file has a field which contains both the time and date. How can I handle this in BW? Do I need to creat 2 infoobjects and split the flat file field in start routine or transfer rule? Or is there any stadard infoobject which can hold both the data and time?
    Also, the client asked me if I want a .CSV file or .XLS file. Which one is better for uploading into BW? Any PROS and CONS?
    Best Regards,

    Hi,
    There is no single Data Type which accepts the Date and Time. Other way is to look the data as CHAR. Else the Update Routine/Formula is the Best
    In the Update Rule or Transfer Rule use the Formula
    Let the Info Objects be
    0date
    0Time
    The Transfer Rule/ Update Rule Formulas Be
    0Date --> LEFT( 8, 'DateTime' )
    0Time --> RIGHT(6, 'DateTime')
    Then CSV is the best Option to accept the Data as it is ready for Upload
    Regards
    Happy Tony

  • How to capture file modification date and time over the web

    HI!
    I am creating a web based application and I am using webutil package for al lot of my work being that I ma working with renamin,deleting and uploading files for a users machine to the database. There is one functionality thing that I have to do in this application that webutil does not take care of and that is capturing the modification date and time from a file on the users machine. Please help me capture the date and time of a file on the users machine.
    Thanks!

    Since webutil allows you to write file on client PC directory, then you first create a directive file, then host that directive file. the directive file content is just the command lines when you manually do it on PC.
    Refer the ideas--just the ideas not the same built-ins in this URL:
    Hyperlink in forms

  • How to get local file date and time ( 10g version )

    Hi,
    Would like to ask if there is any way to get the date and time of a local file. It seems that webutil does not have this function.
    And I want to use client_host ( dir c:\file.txt > c:\temp.txt ) and the read this file to get the file date.
    But the problem is the file date and time ( in the dir ) varies in different PCs.
    Best Regards,
    Ivan

    But the problem is the file date and time ( in the dir ) varies in different PCs.
    You mean the format of the date and time don't you?
    If so you maybe could create a java bean which does that for you using the lastModified Method of the File class.
    regards

Maybe you are looking for

  • Installing Yosemite on MacBook Pro didn't succeed.

    With my Macbook Pro running smoothly under OSX Mavericks, I tried to upgrade to OSX Yosemite with a clean installation by an Install OSX Yosemite USB stick. But after about 8 minutes of installation I got an message on my display that there are probl

  • Reconnection problem to Oracle v805 db

    Hi, my app is suppose to reconnect to the db after the db shutdown and the db starts up again. My code, MS VC++ 6.0 see below, works for Oracle v816 but fails at the open dynaset statement for v805. Any ideas? oresult ores ; ODatabase = m_odb; ores =

  • Any one please tell me what is factory calendar ID .

    hi abapers , this is the reqirment  i am creating factory calendar using fm  DATE_CONVERT_TO_FACTORYDATE  . but in export parameters it was asking  factory_calendar_id  ? . please tell me any one Regards venkat.

  • How do i a setup shortcuts on my desktop?

    i would like to setup some shortcuts to some of my drives...and software on the desktop...thanks

  • There are no working audio drivver for windows 7 for the presario v5209us

    The driver from the xp page, works, but there are issues with it. It will install, but then after installation, the mute button flickers on and office when you go idle. And when you click something on a link or something, then it will flick back on,