How to spool file with a timestamp/seq_number in the file name

Hi I try to write a test script that will have some kind of timestamp or seq_number in the spool output file's filename itself.
so e.g.
test_abc_20120425161616.txt
I can do it on shell but is there a way I can do it all in sqlplus.
I recall I see something similar in statpack long time ago..

vxwo0owxv wrote:
Hi I try to write a test script that will have some kind of timestamp or seq_number in the spool output file's filename itself.
so e.g.
test_abc_20120425161616.txt
I can do it on shell but is there a way I can do it all in sqlplus.
I recall I see something similar in statpack long time ago..
>Hi I try to write a test script that will have some kind of timestamp or seq_number in the spool output file's filename itself.
so e.g.
test_abc_20120425161616.txt
I can do it on shell but is there a way I can do it all in sqlplus.
I recall I see something similar in statpack long time ago..
set termout off
col dt new_value dt
select to_char(sysdate,'YYYYMMDDHH24MISS') dt from dual;
set termout on
spool file_&dt
-- place your SQL here
spool off
Handle:     vxwo0owxv
Status Level:     Newbie
Registered:     Mar 14, 2011
Total Posts:     142
Total Questions:     79 (59 unresolved)
WHY am I NOT surprised?
Edited by: sb92075 on Apr 24, 2012 4:37 PM

Similar Messages

  • How to place file names with thumbnails?

    I have several thousand images that need to go online but I cannot for the life of me figure out how to add file names to the thubnails. Every bit of documentation I've read talks about adding it to the larger images only. I figured that part out but can't I have file names for the thumbnails too?

    Bummer. I was hoping for a secret key to take me there. I have too 
    many images that can be scanned via thumbnails and for the detail 
    shots they can go larger. There is no way I can use this as it is with 
    9000+ images that need to be gone through quickly. Thanks for the 
    answer.
    Mark

  • How to create Rules with Flex Field mapping in the bpm worklist

    I Have created a flex field label and was able to map to the flex field attributes .
    But when i try to create a rules , I don't see the label or the flex attributes in the task payload .
    Can someone please help is understanding how to create Rules with Flex Field mapping in the bpm worklist .
    Even I am also searching for any scripts which will take the flex fields prompts and can directly create a label in the bpm worklist .
    Any pointers or suggestion is highly appreciated .

    Hi,
    SE38 -> Enter program
    Select Variants button and display. In the next screen, enter a variant name, (If not existing , press Create to create new one), else click on Change.
    Now the selection screen will display with a button "Variant Attributes" at the top.
    Click on that button.
    In the next screen, go to the selection variable column of the date field. Press F4 or drop down and select 'D' for date maintenance.
    In the column "Name of Variable (Input Only Using F4)" press F4 or drop down, select whichever kind of date calculation you want and save the variant.
    Now whenever you run the prgrm with this variant, date will be displayed by default.
    Regards,
    Subramanian

  • How to edit file names.

      How to edit file names.

    Right click the file and choose "Rename".
    Type the new name and press "Enter".

  • How can I record with GarageBand 1.3 in the background using other app?

    How can I record with GarageBand 1.3 in the background using other app?
    I use iPad 2 with iOS 6 and GarageBand v1.3.
    I'd like to play an other app like Sunrizer synth while the GarageBand is recording in the background in a track.
    By now I can do it only using the build-in mic of iPad, but this is not the point.
    Can I record other apps in a GarageBand track?
    Thanks a lot for your time.

    I suspect you are probably correct about the reasoning, although there are already a myriad of ways to do that.
    Don't get me wrong - I never said I like this. But it is consistent with other Apple applications, that are similar restrictive; you cannot take a screenshot, when dvd-player is running for example.
    That are the moments, when I am glad that MacOS X is a unix system under the hood

  • So I've changed my hard drive for an ssd and now I've been told to enable trim now I've got the apple cover will they show me how to enable it with out some program of the internet ?

    so I've changed my hard drive for an ssd and now I've been told to enable trim  ?  now I've got the apple cover will they show me how to enable it with out some program of the internet ?

    Use an app called chameleon ssd optimizer.
    I enabled trim with it after almost a year of having installed a Samsung 840 pro SSD and my read/write speeds almost quadrupled.
    I would definite;y advise using it even though Samsung SSD's come with there own garbage disposal.
    Hope that helps.

  • How to spool file to where start script file located

    I'm writing a sqlplus script, eg. runMe.sql, which is going to run in customer env, will generate some data files eg. result.csv.
    By specify location such as 'spool /certain/path/on/disk/result.csv', I can spool to any path I want. However, my concern is  below:
    1. We gets many customers and the script might be run under different location.
    2. I don't know where customer would save the script, furthermore, I don't want customer to input location manually every time.
    3. Generally, customer would run the script something like "sqlplus username/password@sid @/certain/path/on/disk/runMe.sql". They don't want to pass any parameter at run time.
    4. I wanna spool file to "/certain/path/on/disk" automatically, as a result, result.csv file would appear under same path with runMe.sql.
    5. I tried "spool ./result.csv" but it navigate to where sqlplus session is running.
    6. Also tried &0 etc, but make no sense.
    Can anyone tell me how to obtain start running script file path in sqlplus script(runMe.sql) ? Just like access command parameters under Linux.
    $0 is the name of the command
    $1 first parameter
    $2 second parameter
    $3 third parameter etc. etc
    $# total number of parameters
    $@ all the parameters will be listed
    Thanks in advance.

    Are you looking for SQLPATH ?
    A good and clear example by Paul @ https://forums.oracle.com/message/3727891
    In this way your customer has to set one environment variable SQLPATH=/location/of/script/file/where/they/put/your/runMe.sql and just say :
    spool %sqlpath%\result.csv
    in your runMe.sql.  So, runMe.sql and result.csv will be on SQLPATH location.
    Regards
    Girish Sharma

  • How to incorporate File name and timestamp automatically into select and save file dialog box?

    Hello,
    i am trying to incorporate the file name which is inputed by the user along with the timestamp into the selected and save file dialog box. Can you help?
    Thanks
    Solved!
    Go to Solution.

    You can pass a default file name to the 'File Dialog' Express VI.
    Use the 'selected path' output to open the file.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    FileDialog.vi ‏21 KB

  • How to Read file name which we are dealing with ODI File tool

    Hi,
    We are using ODi10g version and we have requirement to move file from one place to another place. We are using ODIFileMove utility but we also want to read file name.
    Any help.
    Thanks in Advance.

    You can accomplish this with a fairly simple Jython script.  Use the os.listdir(<directory>) command to get the name of files in a given directory. 
    You can then (still in the Jython script) loop through the files and move them to a desired location (bypassing the OdiFileMove tool) OR use the Jython script to write the file names to a SQL table.  Then, use an ODI procedure to loop through the newly inserted records and store the file name in an ODI variable that you can then use in your OdiFileMove tool etc.
    I often refer to this blog entry from Gurcan Orhan as a starting point for this kind of task: Loading multiple files with ODI | Gurcan Orhan&amp;#039;s Oracle Data Integrator Blog

  • How to modify file name with the press of a radio button

    Hello,
    I have a simple task that I am having some trouble completing. This is what my program is doing:
    My VI takes 3 angles between -180 and 180 and computes the XYZ coordinate using a mathscript node. Then every time I press Trigger, the current 3 angles and their corresponding XYZ coordinate are written to a spreadsheet file.
    I need to tweak the VI some more to accomplish the following:
    The first time I select the radio button Point (or Line), I would like the spreadsheet file name to be "Point001" (or "Line001"). Then I want to press the Trigger 10 times, write to that file just created, "Point001" (or "Line001"), and after the 10th Trigger, I would like the radio button Point (or Line) to become automatically unselected.
    The next time I select the radio button Point (or Line), I would like the spreadsheet file name to now be "Point002" (or "Line002"). Then I want to press the Trigger again for 10 times, write to that file just created, "Point002" (or "Line002"), and after the 10th Trigger, I would like the radio button Point (or Line) to become automatically unselected, again.
    And so on...
    Basically, I am trying to increment the filename Pointxxx each time I select the radio button. I want to write to that file 10 times, at which point the radio button Point automatically becomes unselected.
    I hope it is clear to what I am trying to do. Any help would be appreciated.
    r15
    Attachments:
    Untitled 1.vi ‏67 KB

    I attached my working VI.
    Now, the problem is that Trigger is saving to a different file each time as opposed to having the 10 Triggers save to one file.
    This is what is happening now:
    When I have the radio button Point (or Line) selected:
    Trigger (1st time) saves to "point1" (or "line1")
    Trigger (2nd time) saves to "point2" (or "line2")
    Trigger (3rd time) saves to "point3" (or "line3")
    Trigger (10th time) saves to "point10" (or "line10")
    Then, Point (or Line) is deselected.
    What I need is the following:
    When the radio button Point (or Line) is selected
    Trigger (1st time) saves to "point1" (or "line1")
     Trigger (2nd time) ALSO saves to "point1" (or "line1")
    Trigger (3rd time) ALSO saves to "point1" (or "line1")
    Trigger (10th time) saves to "point1" (or "line1")
    Then, the radio button Point (or Line) is deselected.
    Next time I select Point, I want the Triggers to write to "point2".
    Can you fix this for me?
    Thank you
    r15 
    Attachments:
    Test.vi ‏71 KB

  • 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

  • Updating a spool file name

    I am running a weekly procedure that spools out to a specificied file but is currently overwriting the pre-exsisting stored file. How do I assign a date time stamp to the spool command to create a new file each time I run the procedure?

    That worked great. Now what about....
    I run this report for the last month with output by week, here is my current code:
    SELECT COUNT(FACILITYID) "Two Weeks ago", DESCRIPTION
    FROM place p, report r
    WHERE p.CONTROLNUMBER = r.SUBLINK AND
    TRUNC(r.movedtoproduction) >= (TRUNC(SYSDATE )-14) AND
    TRUNC(r.movedtoproduction) <= (TRUNC (SYSDATE)-08)
    AND ((p.facilityid <> ****))
    AND ((p.facilityid <> ****))
    AND ((p.facilityid <> ****))
    GROUP BY p.DESCRIPTION
    ORDER BY p.DESCRIPTION ASC;
    I would like to change "Two Weeks Ago" to 'date periods for two weeks ago.
    Thanks again.

  • How to delete file names from Adobe Reader list

    How can I delete file names from the Adobe Reader list?  I have deleted the file & it's empty, but deleted file names remain in my list & it's very annoying.  I can't seem to find an option anywhere to delete the file names.

    Thanks for the answer, I will try this & post my results with this method.  I have set the amount to zero, & it seems if I want to put back valid files into my list I first need to find them in another file in my pc, such as documents, open them in Adobe Reader, & then then they will reappear in the Adobe Reader list.  Is this correct?  Thank you!
    This seems to be the case, you need to restore each file you want in your list one by one by accessing them elsewhere on your pc, & then you must open them with Adobe Reader to have files reappear in your Adobe Reader list.  However, this seems to be a tedious process if you only want to delete one obsolete file from your list by first emptying the list & rebuilding it file by file.  It works, but I'm wondering if there is a more sensible & efficient way to do this?

  • How to keep file name in print queue when printing crystal report

    We are using VB .Net 2003 + Crystal Report 2008 SP2 up to Fix Pack 2.6
    When the VB program spools crystal report files to print queue, the print queue only shows "Crystal Report" for each document.  How to keep the original file name?  In the past when we were using Crystal Report 11, the original file name can be shown in the print queue.
    Please help because it's so important for operation to see which report is failed in printing when reports are printed in batch.
    Thanks

    Hello,
    Set the PrintOption.JobTitle value for the print job. Here's C# code on how to:
                   System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
                CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
                CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new PrintOptionsClass();
                   pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;          
                   rasPROpts.PrinterName = cboCurrentPrinters.Text;               
                   rasPROpts.PaperSize = (CrPaperSizeEnum)
                        pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
                // this sets the name of the print job
                rasPROpts.JobTitle = "MYPrintJob";
                   rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
                   MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );
    Thank you
    Don

  • How to add file name by sqlldr

    Hi All,
    Can anyone kindly give me an approach to use a variable in a sql loader ctl file. I am trying to add the value before each insert of row and this value is the file name. So the question is how can I dynamically identify the input data file name, if not, is there a way I can make my SQL Loader to insert a value (file name) before each row into the table.
    my control file like below ,
    LOAD DATA
    INTO TABLE "user"."AAA_BILL"
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    EXCEPTIONS "USER"."AAA_BILL"
    FIELDS TERMINATED BY '|'
    (Streamnumber ,
    MSID ,
    UserName,
    Domain,
    UserIP ,
    Correlation_ID)and the loading script as below ,
    for j in $(GetFileNames)
    do
    let i=$i+1
    sqlldr user/pass control="/u01/ctrlfile/loadBILLDtl.ctl" log=$WiMAXlog$j.log data=$WiMAXsource$j   bad=$WiMAXlog$j.bad
    GetFileNames ()
    sqlplus -s user/pass << EOF
    set echo off
    SET FEEDBACK OFF
    SET heading off
    set pagesize 50000
    select bi_file_name from dbm_bill_head where bi_file_name like 'WiMAX_%' and bi_auto_status=35  order by bi_file_name;
    EOF
    }What I am trying to accomplish here is, I want to insert the data file name along with other data in the data file into table AAA_BILL and this table has the file name coloumn, but the data file does not contain the file name as one of its contents.
    Note : my DB is 10G and OS is RHEL
    any help please ,
    Edited by: 876602 on 18/12/2011 05:44 ص

    Hi,
    Now it is working just well.
    I kept 2 variables: one with the POSIX file path for my do shell script and another one (using the provided tip here) for the Applescript function.
    The only problem I had left was that teh file was writen in, maybe, UTF8 so I added to the open for access a "as text" at the end to make the file as straith text file.
    I always found languages like Applescript a little bit hard to learn. Strangely, I have less difficulty with Cocoa!
    Thanks for avery one here!

Maybe you are looking for

  • T-code : FF7A - grouping issue

    Dear all,   As shown in the image below,for transaction FF7A, where can i define the new grouping criteria or change the existing grouping since we added one more bank account( the one where the red arrow pointed ) ? please advise. Thank you <a href=

  • PKCS#11 authentication fails with sec_error_token_not_logged_in

    I am using a smart card (CAC) to login to a website. Logging out of the website and trying to log back in causes firefox to show the sec_error_token_not_logged_in error instead of asking for my pin. Steps to reproduce: 1. Use smart card to login to a

  • Main centre button only working intermittently

    Several times a day now I will have to turn my iphone 4 off,& then turn it back on to be able to access a different function.  It used to only do it occasionally...now it is locked in this manner for hours at a time.  Any suggestions???

  • I am trying to sync my iPod to my iTunes on my netbook

    iTunes on my netbook seems to have stopped recognizing my old iPod, so it is bringing up the new iPod tutorial when I connect it. However, I just get to the second page ("Sync with itunes") and can't move past it. There is no button to continue or cl

  • 150:30

    I've bought a new Macbook Pro with Yosemite 10.10.2. Installed old favorite programs from my old compute with time capsule. Sadly though I can´t start Indesign and photoshop, both bought in the CS4 versions. Bridge works though. When Indesign or Phot