Date and time in spool file name

Hi,
can anyone show me how i can write the code below so that the spool file will automatically take the system time and date?
thanks again.
set term off;
set echo off;
set heading off;
set linesize 1500;
set pagesize 9999;
set feedback off;
spool /home/oracle/ATM_Upload/files/CRD000119MMDDYYHHMISS.DAT;
SELECT rec_ind||source_type||bbdsa_code||seq_num||dt_ti_ext||ver_num
as atm_header
FROM atm_dc_hd;
spool off;

Hi,
I do something similar to this in a file called ed.sql which I use in SQL*Plus to give me a history of SQL*Plus buffers in separate files which follow the naming convention $DATABASE_$SID_$TIMESTAMP.sql. I use it from SQL*Plus when editing, rather than typing "ed" I type "@ed" and it does the naming for me:
-- Turn off terminal output
set termout off
-- Save current buffer to a temp file
save tmp.txt replace
-- Set editfile name to $DATABASE_$SID_$TIMESTAMP.sql
column fname new_value fname
column sid new_value sid
select trim(sid) sid
from v$mystat
where rownum = 1;
select global_name||'_&sid'||'_'||to_char(sysdate, 'YYYYMMDDHH24MISS')||'.sql' fname
from global_name;
set editfile '&fname'
-- Retrieve our initial buffer
get tmp.txt
-- Turn terminal output back on
set termout on
-- Fire up the editor
edYou could probably adapt this in the following way for your needs:
column fname new_value fname
select 'CRD000119'||to_char(sysdate, 'MMDDYYHH24MISS')||'.dat' fname
from dual;
spool '&fname'I don't know how you get the 'CRD' part of the filename but you may be able to generate that too using the above as a guide.
cheers,
Anthony

Similar Messages

  • Help adding current Date and Time stamp to file name

    I need help with my script adding current Date and Time stamp to file name.
    This is my file name = myfile.htm
    I would like to save it as = myfile.htm 8/29/2007 11:41 AM
    This is my script:
    <script>
    function doSaveAs(){
         if (document.execCommand){
              document.execCommand('SaveAs','1','myfile.htm')
         else {
              alert("Save-feature available only in Internet Exlorer 5.x.")
    </script>
    <form>
    <input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
    </form>
    Thank you

    I agree, I guess I overlooked that!
    I would like to save it as = myfile 8/29/2007 11:41 AM .htm
    I need help with my script adding current Date and Time stamp to file name.
    This is my file name = myfile.htm
    I would like to save it as = myfile 8/29/2007 11:41 AM .htm
    This is my script:
    <script>
    function doSaveAs(){
    if (document.execCommand){
    document.execCommand('SaveAs','1','myfile.htm')
    else {
    alert("Save-feature available only in Internet Exlorer 5.x.")
    </script>
    <form>
    <input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
    </form>

  • 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.

  • How to get last modified date and time of a file which is in apache server.

    Hi ,
    I need to get last modified date and time of a file in remote machine.
    This file is in remote machine which has apache server installed.
    I am trying to get this information by connecting to apache server from client by giving absolute URI of the file to file object.
    URI is got from apache server URL by using toURI method.
    when I use lastModified method , its throwing exception , because scheme of URI is not file.
    I can't give scheme as file because ftp server is not installed on that server
    Is there any other way to get this information .

    No, unless you can use an FTP client.

  • 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.

  • Changing Date and Time with dng files

    My camera settings for date and time were wrong.
    So some of my files in Lightroom 3 have the wrong dates.
    This morning I downloaded Photoinfo 2.0.1 but it doesn't seem to want to accept "dng" files to change the info.
    It will accept "jpeg" files no problem.
    Can anyone help me with this.
    Thanks

    Open the Catalog Setting panel (Lightroom menu on Mac and Edit menu on Windows). Configure the Metadata>Exif tab as shown in red on screenshot. Select your images and choose Save Metadata to File (Ctrl/Cmd+S) from Metadata menu (same menu as Edit Capture time. This will save the date/time changes back into the file rather than just the catalog.

  • Date and time of photo files in PSE 10

    I imported about 1000 photo files (JPG) into my catalogon my desktop PC from files that I had saved on my laptop PC while on vacation.  Most of the files were imported with no problems, but some of them were saved with the wrong time and date information.  My folders are named for the date the pictures were taken, e.g., 2012-03-12.  A few of the files were in a folder inside a folder for a different day, "c:\users\Don\My Pictures\2012-03-12\2012-03-08".  What causes this?  How can I get PSE10 to work porperly?
    I have Windows 7, 64-bit PSE10, and an HP-PC with 8GB RAM.

    Thanks for the reply Brett N. 
    I read some previous posts on date problems, and one answer said that if the import was done outside PSE10, all bets are off as to the correct results.  That made me remember that I copied the folders and files to my desktop PC using Windows Explorer and then PSE10 found them as new files.   I assume that my problems were because of not using PSE10 to import the files.
    I am going to mark your reply as the correct answer, and give up on this issue until the next time I import files.

  • Automatically set date and time in PDF file

    Good Day to all
    I use LiveCycle to create a PDF template so my users can fill up reports with out printing, the problem is the "time/date" field changes every time the supervisor open the file, so there is no way to track the date the report was created.
    I'm looking for a way (any trick) to make the automatically set but only when I save the document instead when I open it, I hope I'm explaining myself.
    Or maybe I just need to use another software, if you can recomend me one, or a trial just to be sure is the one I need.
    Any help would be great!!!...
    Thanks!!!

    You probably might have placed the code to populate the Data/ time value on the initialize event. Before you assign the current system date, check if the field has a value already. If it has then do not assign a new value.
    Thanks
    Srini

  • 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

  • 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

  • Lightroom changes file date and time

    When I imported a large number of images to Lightroom, keeping the files in their original location, the dates and times of the files were updated. This is a bit of a pain because it means that about 4000 files will now be backed up again to the online backup service I use. Why does LR change the filedate when all it's doing is importing to the library?

    > Alexander wrote: I believe you have set the option to "Automatically write changes into XMP" and are working with non-raw files (jpeg, tiff or dng)? In this case it is the expected behaviour as LR will write any metadata changes right into the files, thus changing the modification date of the image files.
    Either uncheck the above mentioned preference setting or beg Adobe to bring us back xmp side car files for jpeg, tiff and dng.
    No, I'm not stalking you :)
    The following applies to Macintosh OS X, 10.4.8. I don't know if the same happens with Windows.
    I had a similar problem when editing some JPEG file from my Fuji F30. When I would Export the metadata the 'Modified' date of the file changed as expected. However, for certain files, the 'Created' date also changed. I opened a case with Adobe, sent them a description of the problem and some sample files. The Technical Support person reproduced the behavior and passed the information to Engineering.
    Yes, Adobe, give us XMP files for all files.

  • Bug or Feature:  pictures not ordered by date and time taken

    Is this a bug or a feature? 
    Pictures are not displayed in the sequence (order) they where originally taken (timestamp of the camera), when
    - importing pictures via camera connection kit
    - importing pictures via photo stream
    - when editing pictures these.
    I believe, Apple chose the date and time the picture file was created or last edited.
    I'd rather have the pictures sorted by the time they were taken so I have all pictures in chronological order.
    What about you?

    Hi
    I had a lot of problems sorting the display order on my two iphones and ipad
    The order displayed is 'Date taken' and then 'Date modified', but any photo without a 'date taken' will appear at the bottom , not the top
    goto to this link, have a read of my post
    https://discussions.apple.com/message/21098432#21098432
    Hope this helps

  • 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.

  • 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

  • Name of the file (in utl_file) with date and time

    Instead of the below:
    vHandle1 := utl_file.fopen('/home/oracle/testdir', 'test.csv', 'W');
    I want something like this:
    vHandle1 := utl_file.fopen('/home/oracle/testdir', 'test19dec200611.35.csv', 'W');
    i.e the name of the file should have the date and time too so that every time the original is not overwritten.
    Is this possible?

    OR maybe we can use this:
    utl_file.frename('/home/oracle/testdir','test.csv,'/home/oracle/testdir','test'||to_char(sysdate,'DDMONYYYYHH24:MI')||'.csv',TRUE);
    Will it work?
    Can we download this file and open it through oracle (and not any front end like ASP etc.)

Maybe you are looking for

  • Upgrade from 4.7 to ecc 6.0

    hi it would be great help if you tell me about the upgrade from 4.7 to ecc 6.0 am an sd functional consutlant so wat would be my role in this upgrade and are the transaction codes and menu path same or have some changes in it and could please tell me

  • Can't Export Standard MIDI Files in Logic 9.1.1 .... ?!?!

    Hi Everyone, So I just upgraded to Logic 9.1.1. I was working on a simple MIDI project pre-upgrade in which I exporting all the tracks and data as a standard MIDI file, all fine and dandy. Now today, with upgrade, I have the same project, and wheneve

  • Iphone5c not recognizing/syncing in itunes.

    hi I have just got a new iphone 5c and connected it to itunes but the itunes wont recognize my phone, my computer has but usually with my old iphone 4 it synced automatic but with this phone nothing happens..please help.

  • 2px Difference Between FF Mac and IE, FF(PC)

    The Colored Menu Links on my test page have a 2px difference in height between FF-Mac and IE, FF-PC. Any idea what is causing this? Is it me or should I use a conditional comment? Test Page Here CSS Here Rich

  • Cant connect AppleTV as remote speakers

    AppleTV will no longer connect as a remote speaker from iTunes. I always get the following even though my iMac and AppleTV are active on my home network: An error occured while connecting to the remote speaker "Apple TV". An unknown error occurred (-