Calling SQL Loader with Dynamic file names

HI all
I woul like to know if I can call sql loader as below
$ sqlldr userid=uname/pwd control=new.ctl, data=$1
I have to schedule my loader 3 times a day and each time my file names are different(AAA_BBB_timestamp)
Thanks

I have found a solution myself and if any one is interested its like this
for file in `ls -1 /opt/user/from/`
do
sqlldr userid=user/pwd@connect_string control=control_file.ctl data="/opt/user/from//$file"
done
Ramu

Similar Messages

  • Export with dynamic file name

    Hi everyone.
    I want to know how export oracle tables with dynamic file name on windows XP platform.
    bye.

    You'd have to generate the export command-line or par file using a script -- Windows or SQL !
    It would be easy to use SQL to generate the script.
    So you could have a BATch file that
    a. Calls the SQL to generate the export command-line or parfile
    b. Executes the export
    even possibly run in a loop.
    Hemant K Chitale

  • SQL*Loader with multiple files

    Gurus,
    I search the documentation and this forum and haven't found a solution to my issue yet...
    I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
    More specifically....
    I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
    My database: Oracle 10g Release 2
    Operating System: Windows 2003 Server
    Please assist.
    Robert

    sect55 wrote:
    Gurus,
    I search the documentation and this forum and haven't found a solution to my issue yet...
    I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
    More specifically....
    I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
    My database: Oracle 10g Release 2
    Operating System: Windows 2003 Server
    Please assist.
    RobertToo bad this isn't in *nix, where you get a powerful shell scripting capability. 
    That said, here is the core of the solution .... you will also need a way to identify files that have been processed vs. new ones. Maybe rename them, maybe move them. But with this sample you can see the basics. From there it is really an issue of DOS scripting, which would better be found by googling around a bit.
    cd c:\loadfiles
    FOR %%datfile IN (*.txt) DO SQLLDR CONTROL=sample.ctl, LOG=sample.log, BAD=baz.bad, DATA=%%datfileTry googling "dos scripting language". You'll find lots of tutorials and ideas on "advanced" (well, as advanced as DOS gets) techniques to solve your problem.
    Edited by: EdStevens on Dec 1, 2010 5:03 PM

  • SQL loader with *.csv file

    Good morning,
    I have a *.CVS file containing data like this:
    A123456789,Ah Tong Station,Jalan Dungun
    I would like insert the data into a table that returns 1 row for each value
    id outlet_name addr_1A123456789 Ah Tong Station Jalan Dungun
    etc
    In the stored procedure, SQL loader, I used
    Insert into XXXXX values
    (SUBSTR(input_buffer, 1, 10),
    SUBSTR(input_buffer, 11, 60),
    SUBSTR(input_buffer, 61, 110);
    but the problem is that insertion of the outlet_name and addr_1 will not follow the subcripts that provided. Instead in gave an output like that:
    id outlet_name addr_1
    A123456789 ,Ah Tong Station,Jalan Dungun NULL
    Hope to get some advice asap. Thanks. :)
    Pauline

    Why not use the SQL*Loader proper to load this in to your table? It will be significantly faster than anything you could do in PL/SQL, especially if your volumes increase. And it will take care of the parsing for you, as long as you tell it the field delimiter. You've already seen that you can't rely on fixed widths when using delimited data.
    Given this data...
    A123456789,Ah Tong Station,Jalan Dungun
    A234,Some Station,Some Place...the following SQL*Loader control file ( stored in a file called mytable.ctl ) will load your table ( note I've used truncate - you could also append )...
    load data
    infile 'mydata.csv'
    truncate
    into table mytable
    fields terminated by ','
    (  id
    ,  outlet_name
    ,  addr_1
    )This is invoked using the following:-
    sqlldr userid/password@tns control=mytable.ctlThe results are:-
    SQL> select * from mytable;
    ID                             OUTLET_NAME                    ADDR_1
    A123456789                     Ah Tong Station                Jalan Dungun
    A234                           Some Station                   Some PlaceYou will find this much easier. Of course, you could always avoid the database altogether if you don't need to actually store this data. You could just parse the source .csv ( if you are on UNIX this will be really easy using an awk one-liner ) and write it to an output file.
    Anyway, hope this helps.
    Regards
    Adrian

  • Saving Offline PDF form from Web-Dynpro with Dynamic File Name

    Hello All,
    We have a offline PDF form.... When we save the form, a default file name appears. We need to change this default name to some value that is already available in the form fields.
    I have gone through some posts in the forum. However not able to figure out the solution.
    Following are the details:
    1. Web-Dynpro used : ABAP Web-Dynpro
    2. Form Type: Native
    3. Offline Editable form
    Regards,
    Kunjal Patel

    Hi Rajesh,
    I have not yet found a solution....
    Also as you have seen no one is replying.....
    All,
    Should we consider that this issue does not have a specific solution?
    Regards,
    Kunjal

  • IDOC to multiple file with dynamic file names with same content

    Hi,
    My scenario is from IDOC to file.
    The number of files which i need to create is dynamic, which depends on the number of plants.
    I have a Z-table where i will maintin list of all plants ( non SAP plant names).
    I need to fetch the data from this z-table and depending on the nunber of plants i need to create the file for each plant and fiel name should contain plant name in it. EX: abc_<plant>_datatype.txt
    I want to use only receiver one CC, and files should be created in the same directory.
    Can we do this without BPM?

    Hi,
    You can use the Mapping lookup concept to fetch the plant names from Z-tables and then you can use the variable substitution technique to resolve your purpose.
    Here you need to create multiple interfaces ie.e per plant to create multiple files. You can use common Communication channel for all.
    Mapping Lookup
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/frameset.htm
    Mapping Lookups - RFC API
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/frameset.htm
    Variable Substitution
    An interesting usage of Variable Substitution in XI
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    SP12 -Variable Substitution option
    Receiver File Adapter:Variable substitution :FATAL  ERROR
    Thanks
    Swarup

  • Spooling with dynamic file names

    Hi
    i'm having a situation where i need to execute a script daily, the logs of the script should be saved using spool. is there a way to dynamically create a destination file with the filename as "spooled_text_"||sysdate
    like
    spool spooled_text_30_Jan_2008_08_45_AM
    Any help is greatly appreicated
    Thank you

    As follows, in sqlplus...
    SQL> column dt new_value file_date
    SQL> select to_char(sysdate,'YYYYMMDD') as dt from dual;
    DT
    20080130
    SQL> spool file_name_&file_date..log
    SQL> spool off
    SQL> host ls
    file_name_20080130.log

  • In EP, call R3 transaction with dynamic variant name

    Hello
    I know that I can call a R3 transaction with a dedicated variant thanks to the process below:
    Create a transaction iview , Tcode = "START_REPORT"
    In application parameters pass these values separated by '&' sign.
    D_SREPOVARI-REPORT - your report
    D_SREPOVARI-VARIANT - your saved variant.
    choose skip inital screen in the parameters.
    But do you have a tip to call a different variant for every user.
    For example, I have users "1111" and "2222". In R3 I have created the variant "1111" and "2222" for a transaction.
    In EP, I would like that when I call this transaction connected as "1111", the variant "1111" is used, and when I'm logged as "2222", the variant "2222" is used.
    Do you know how I can do that ?
    Thank you !

    Hello,
    where is the information which user has to call which variant stored? If it's in R/3 then you can write an wrapper report which is called from the Portal, adds the Variant information and then calls the original report.
    Regards
    Gregor

  • Need to generate multiple error files with rule file names during parallel data load

    Hi,
    Is there a way that MAXL could generate multiple error files during parallel data load?
    import database AsoSamp.Sample data
      connect as TBC identified by 'password'
      using multiple rules_file 'rule1' , 'rule2'
      to load_buffer_block starting with buffer_id 100
      on error write to "error.txt";
    I want to get error files as this -  rule1.err, rule2.err (Error files with rule file name included). Is this possible in MAXL? 
    I even faced a situation , If i hard code the error file name like above, its giving me error file names as error1.err and error2.err. Is there any solution for this?
    Thanks,
    DS

    Are you saying that if you specify the error file as "error.txt" Essbase actually produces multiple error files and appends a number?
    Tim. 
    Yes its appending the way i said.
    Out of interest, though - why do you want to do this?  The load rules must be set up to select different 'chunks' of input data; is it impossible to tell which rule an error record came from if they are all in the same file?
    I have like 6 - 7 rule files using which the data will be pulled from SQL and loaded into Essbase. I dont say its impossible to track the error record.
    Regardless, the only way I can think of to have total control of the error file name is to use the 'manual' parallel load approach.  Set up a script to call multiple instances of MaxL, each performing a single load to a different buffer.  Then commit them all together.  This gives you most of the parallel load benefit, albeit with more complex scripting.
    Even i had the same thought of calling multiple instances of a Maxl using a shell script.  Could you please elaborate on this process? What sort of complexity is involved in this approach.? Did anyone tried it before?
    Thanks,
    DS

  • Cannot call SQL-Loader in php

    Hello,
    I'm currently trying to call the SQL Loader in a php-script in order to enable users to upload data by themselves by a simple button-click. I tried several things however everytime I'm clicking on the button, nothing happens.
    my code looks as follow:
    if ($upload_csv == "1") {
    $command="SQLLDR *Scheme*/*Passwrd*@*server* log='*server*/abc.log' control='*server*\abc.ctl'";     
    chdir("\\*server*\UPLOAD");
    $exec(command);
    I also tried it in several other ways, for examle calling the sql-loader-command directly or without the command-variable, however nothing worked.
    Am I doing something wrong

    Actually we're using MS Windows Server 2003 and also the call of the SQL Loader shouldn't be any problem as I called the Loader via batch-file on the server directly and it worked just fine - only calling the Loader or even the batch-file via PHP doesn't work...
    Well, I tried something out and moved the php-script to another folder and all of a sudden I started to get error-messages printed on the sceen.
    Tried it then in 2 ways - once with the command "$sell_status = shell_exec(abc.bat);" and got this error message back: CGI Error - The specified CGI application misbehaved by not returning a complete set of HTTP headers.
    Afterwards I also tried it with the exec()-Command and got this error-message back: Fatal error: Function name must be a string in - C:\Inet\root\Intranet\db_admin\test.php on line 14

  • Dynamic file name from input payload (RFC 2 flat file)

    Hi,
    I have an RFC to flat file scenario. The output flat file has not an XML structure, it's just a plain text file generated with abap mapping.
    In my source interface (RFC), I have a field called <FILENAME>, I want to use the value of that field to create the target file using dynamic file name. But if  in variable substitution I use payload:ZRFC_NAME,1,FILENAME,1 It doesn't work because the dynamic variable substitution try to access to output payload, not the source one...
    What can I do?

    Hi Marshal,
           You can add a extra node to your target strucutre like
    FileName- Node
    --FileName - Element.
    do the mapping from the field filename of RFC to FileName field in u r target strucure. And use this  field path at Refrence in variable subtituion.
    In the Content converison add the Name & Values as below
    FileName.fileldNames -- FileName
    FileName.fieldFixedLengths -- 0
    FileName.fixedLengthTooShortHandling -- Cut
    So the extra field in u r target structure would not populate in u r target text file.
    Cheers
    Veera

  • Passing Dynamic File Name to ODI nterface for processing to another system

    Hi,
    I need help regarding passing a Dynamically Name changing fixed length Flat File in ODI Interface. This interface is built for taking the Flat File as Input and process it to SQL Server by applying Data Mapping and transformations... The input Flat File Name is sequence generated for eg: OEORD1123.txt and next file will be OEORD1124.txt and it sits in Oracle Conc tier. How to pass the latest file name to ODI interface for processing
    Regards,
    Anil..

    Hi Guys...
    I would like to suggest a way.
    a) create a single interface with dynamic resouce name (a ODI variable) with a filter to the month column like:
    month_column = '#vCountMonth'
    b) in the refresh tab of a first variable (I named "vMonth"), use the following query: (varialbe should be alphanumeric, "not persistent")
    select to_char(to_date('#vCountMonth','MM'),'month') from dual
    c) create one more ODI variable (I named "vCountMonth"), alphanumeric, not persistent and at its refresh tab write:
    select lpad(to_char(#vCountMonth + 1), 2, '0') from dual
    d) now just create a package, drag and drop the objects in the following order:
    d.1) vCountMonth in set mode and set = 0 (zero)
    d.2) vCountMonth in refresh mode
    d.3) vMonth in refresh mode
    d.4) the interface
    d.5) vCountMonth in evaluate mode, evaluating "= 12"
    ==> if NO (KO, red line) link the KO line to d.2 step
    ==> a OK line is not necessary unless you have others steps after finish the evaluating
    Make any sense? That is a single loop to have the interface developed only one time.
    Please, remember to check each thread reply as Useful or Correct if they are useful to you...

  • Dynamic File Name on Receiver Side using XSLT mapping

    Hi,
      My scenario is a Proxy to File scenario.The File on the receiving side is a TEXT file generated due to XSLT mapping. The file name has to be dynamic like- TEST<DDMMYYHHMMSS>File.DAT.
    If somebody knows how to do the same please help.
    Regards
    Ritu

    Hi Ritu,
    I agree to Krishna.With your XSLT mapping create a XML output which can be converted to a text file with content conversion.
    And for the dynamic file name, i guess its the date that matters which needs to be in DDMMYYHHMMSS format. the same can be accomplished by a Java function and calling it in your XSLT .
    Do refer this weblog it will help you accomplish the same.
    >>> /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Regards,
    Shabarish

  • How to handle Dynamic File Name

    Hello All,
    I have a  requirement, I have to download a file from application server to my ABAP program which will be executed in the background. The problem is the file name is a dynamic file name with timestamp on it. So how do I read the file from the application server. I know there are certain function modules but I don't think so that they can work in background.
    So If anyone has worked on it before your reply would be helpful.
    Thanks and Regards,
    Sushil

    Hi,
    Use this funcation module this will return you the list of files in a directory...
    It will work even in back group processing also..
    SUBST_GET_FILE_LIST
    or if it is unix environ ment.
    data: begin of t_tabl occurs 0,
    line(132),
    end of t_tabl,
    data: lc_command(100) type c.
    Get all the file name falling under specified directory...
    lc_command(3) = 'ls '.
    lc_command+3(45) = p_dir. " Directory of file path
    call 'SYSTEM' id 'COMMAND' field lc_command
    id 'TAB' field t_tabl-sys.
    Check any files exits in the directory.......................
    if t_tabl[] is initial.
    message e006 with 'No files exist in the specified directory ' p_dir.
    endif.
    here you will have all the file names in t_tab1 you can sort by name and will get the latest file in order..
    Thanks
    Mahesh
    Message was edited by:
            I Can Solve It

  • Issues in calling Sql Loader through forms developer (10g)

    Hi,
    I am developing a form(in 10g) ,in which I am calling sql loader for loading data onto a oracle database table from external source (e.g. data file is a .CSV file).
    But , somehow the sql loader is not getting executed.
    Here , I am giving the environment settings , approach i am taking;
    This is a distributed system , both the application server,and database server are mounted on two different servers.
    The form is delpoyed on the application server.
    The database table , and the sql loader are configured on the databse side.
    I am using host(<sql loader command>) command to invoke the Operating System command through forms.
    The sql loader is working ok , and the data is getting loaded successfully onto the required database table when I am executing the sql loader command on Unix prompt , but through the forms , it's not working.
    Do I need to change some environmental setting to make this work...
    Any quick help in this regard is highly appreciated.
    Thanks.

    Hi Craig,
    I have already tried out the option of calling sql loader through stored procedure,but this is not working ...
    could you please share any examples to do so ...
    code snippet i am using in forms:
    declare
    usid get_application_property(userid);
    pwd get_application_property(password);
    db get_application_property(host);
    msqlldr varchar2(250);
    begin
    msqlldr:='/u01/oracle/formss/bin/sqlldr' username=<uid/pwd@db> control=<control file name> data=<data file name> log=<log file name>
    hosts(msqlldr);
    end;
    Note that sqlldr command ,for that matter any unix shell command is not working through the hosts() command ...
    could you please suggest any way out ...
    Thanks.

Maybe you are looking for

  • List of issues with PC suite

    Hello everybody, This is my first post here. I've been using PC suite for a while (over 2 years now) with my 6131 and even when there was a lot of improvements in PC suite, I've found some problems and inconsistencies in the use. First, sometimes whe

  • How to start ipad2 without a cover?

    As a new owner of ipad2, I bought an after market leather cover which does not accommodate the cover which starts ipad.  How do I start the ipad without the cover?

  • Exclamation mark! Not recognising external drive has been reconnected.

    All my Itunes music is stored on an external hard drive. Foolishly I must have pressed play whilst the drive was disconnected and I now have an exclamation mark next to every track. This will mean that the next time I connect my Ipod there will be a

  • Text truncated

    Post Author: Butters CA Forum: .NET Hi All, I've seen a couple of posts regarding text truncation on a crystal report. However, I'm new to crystal reports and I wasn't the person who created the report so am unsure of the settings, and why my text ou

  • MG5420 Is There a Way to Sharpen Print-on-Disc Artwork?

    Hello, BOTTOM LINE: Can I change the Print Quality setting when printing my artwork on a printable disc? I recently changed from an Epson R220 printer to a Canon MG5420. Both allow direct printing onto printable CD and DVD discs. I changed printers b