SQLLoader: Uploading data file name along with data

I am using Oracle SQLLoader to upload my data from CSV files into a single table. My current CTL file is as follows:
LOAD DATA
INFILE 'trace_metals100.csv'
INFILE 'trace_metals101.csv'
APPEND
INTO TABLE TRACE_METALS
FIELDS TERMINATED BY ','
(STATION_NO, METAL_NAME, METAL_WT)
Just for my record I want to upload the data file name also along with the data into a fourth column. How should I do it using SQLLoader??
Regards,
Moiz

Do two loads using two separate control files:
LOAD DATA
INFILE 'trace_metals100.csv'
APPEND
INTO TABLE trace_metals
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(station_no,
metal_name,
metal_wt,
fourth_column_name CONSTANT trace_metals100.csv)
LOAD DATA
INFILE 'trace_metals101.csv'
APPEND
INTO TABLE trace_metals
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(station_no,
metal_name,
metal_wt,
fourth_column_name CONSTANT trace_metals101.csv)

Similar Messages

  • File name substitution with Data pump

    Hi,
    I'm experimenting with Oracle data pump export, 10.2 on Windows 2003 Server.
    On my current export scripts, I am able to create the dump file name dynamically.
    This name includes the database name, date, and time such as the
    following : exp_testdb_01192005_1105.dmp.
    When I try to do the same thing with data pump, it doesn't work. Has anyone
    had success with this. Thanks.
    ed lewis

    Hi Ed
    This is an example for your issue:
    [oracle@dbservertest backups]$ expdp gsmtest/gsm directory=dpdir dumpfile=exp_testdb_01192005_1105.dmp tables=ban_banco
    Export: Release 10.2.0.1.0 - Production on Thursday, 19 January, 2006 12:23:55
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "GSMTEST"."SYS_EXPORT_TABLE_01": gsmtest/******** directory=dpdir dumpfile=exp_testdb_01192005_1105.dmp tables=ban_banco
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 64 KB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/COMMENT
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    . . exported "GSMTEST"."BAN_BANCO" 7.718 KB 9 rows
    Master table "GSMTEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
    Dump file set for GSMTEST.SYS_EXPORT_TABLE_01 is:
    /megadata/clona/exp_testdb_01192005_1105.dmp
    Job "GSMTEST"."SYS_EXPORT_TABLE_01" successfully completed at 12:24:18
    This work OK.
    Regards,
    Wilson

  • I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data is not.) but

    I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data does not.)

    HI Dave,
    I'm surprised you get no message when you attempt opening the Excel document in Numbers.
    I'm assuming Numbers 3.1, since you are running Mavericks.
    Does the Numbers file that opens show any content?
    Does it contain a table?
    How large?
    Does it contain more than one tab (indicating more than one sheet)?
    Do those other tabs contain a table?
    Have you checked those tables for data content?
    There have been cases in the past of imported documents opening with white text on a white background, giving the appearance of containing nothing. Check for this by selecting a block of cells, then applying a Fill colour or a Text colour using the Format button (paintbrush).
    I'd also suggest attempting to open the Excel files using LibreOffice, which can be downloaded from the linked website.
    Regards,
    Barry

  • How to store data file name in one of the columns of staging table

    My requirement is to load data from .dat file to oracle staging table. I have done following steps:
    1. Created control file and stored in bin directory.
    2. Created data file and stored in bin directory.
    3. Registered a concurrent program with execution method as SQL*Loader.
    4. Added the concurrent program to request group.
    I am passing the file name as a parameter to concurrent program. When I am running the program, the data is getting loaded to the staging table correctly.
    Now I want to store the filename (which is passed as a parameter) in one of the columns of staging table. I tried different ways found through Google, but none of them worked. I am using the below control file:
    OPTIONS (SKIP = 1)
    LOAD DATA
    INFILE '&1'
    APPEND INTO TABLE XXCISCO_SO_INTF_STG_TB
    FIELDS TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    COUNTRY_NAME
    ,COUNTRY_CODE
    ,ORDER_CATEGORY
    ,ORDER_NUMBER
    ,RECORD_ID "XXCISCO_SO_INTF_STG_TB_S.NEXTVAL"
    ,FILE_NAME CONSTANT "&1"
    ,REQUEST_ID "fnd_global.conc_request_id"
    ,LAST_UPDATED_BY "FND_GLOBAL.USER_ID"
    ,LAST_UPDATE_DATE SYSDATE
    ,CREATED_BY "FND_GLOBAL.USER_ID"
    ,CREATION_DATE SYSDATE
    ,INTERFACE_STATUS CONSTANT "N"
    ,RECORD_STATUS CONSTANT "N"
    I want to store file name in the column FILE_NAME stated above. I tried with and without constant using "$1", "&1", ":$1", ":&1", &1, $1..... but none of them worked. Please suggest me the solution for this.
    Thanks,
    Abhay

    Pl post details of OS, database and EBS versions. There is no easy way to achieve this.
    Pl see previous threads on this topic
    SQL*Loader to insert data file name during load
    Sql Loader with new column
    HTH
    Srini

  • Date, File name, User Stamp

    I've looked for hours for a script that will work in Illustrator CS4 that will put a text block on the page identifying:
    Date, File Name and the User's name on the document (art board)
    I am not versed in scripting. Can anyone help me out?

    Hi Y'all  This post is where scripting all started for me. At the time I didn't know anything and Muppet Mark kindly helped me out. Since then I have learned Applescript and written my slug script in that. This has the advantage of being able to access system information. Here it is:
    -- captures the user's first name from the system for use in dialog boxes
    set myName to (long user name of (system info))
    set sp to (offset of " " in myName)
    set myFirstName to text 1 thru (sp - 1) of myName
    -- captures the user's short name from the system for use in the slug
    set myShortName to (short user name of (system info))
    set myInitials to text 1 thru 2 of myShortName
    tell application "Adobe Illustrator" to set myDocCount to count of documents
    if myDocCount > 0 then
        tell application "Adobe Illustrator"
            try
                set myPath to file path of document 1 as alias -- if the document is not saved this will cause an error
            on error
                display dialog "You haven't saved document yet " & myFirstName & "." buttons {"Cancel", "Save"} default button 2
                -- brings up Save As dialog box
                tell application "System Events" to tell process "Adobe Illustrator"
                    click menu item "Save As..." of menu 1 of menu bar item "File" of menu bar 1
                    tell application "Finder"
                        set filesavepath to "/Volumes/Server/Folder" -- put your own file path in here
                    end tell
                    delay 0.2
                    tell window "Save As"
                        keystroke "g" using {command down, shift down}
                        repeat until exists sheet 1
                            delay 0.5
                        end repeat
                        tell sheet 1
                            keystroke filesavepath
                            click button "Go"
                        end tell
                    end tell
                end tell
                -- end Save As dialog box
                return
            end try
            set myFile to name of document 1
            set myFolder to myPath as string
            -- this section looks at the file info to get the file version information
            set myFileVersion to my getVersion(myPath)
            set AppleScript's text item delimiters to "Created"
            set myFileVersion to text item 1 of myFileVersion
            if myFileVersion is "Saved As v.15 " then
                set myFileVersion to "Illustrator CS5"
            else if myFileVersion is "Saved As v.14 " then
                set myFileVersion to "Illustrator CS4"
            else if myFileVersion is "Saved As v.13 " then
                set myFileVersion to "Illustrator CS3"
            else if myFileVersion is "Saved As v.12 " then
                set myFileVersion to "Illustrator CS2"
            end if
            set AppleScript's text item delimiters to {""}
            -- end of file info
            set AppleScript's text item delimiters to ":"
            set clientFolder to text item 3 of myFolder -- always picks out the client folder on our server
            set AppleScript's text item delimiters to {""}
            if clientFolder contains "_" then
                set clientFolder to my cleanName(clientFolder) -- to format the client names properly
            else
                set clientFolder to clientFolder
            end if
            -- find the current date. This is the date when the file was last edited but this method enables you to run the script before saving
            tell application "Finder"
                set myDate to (current date) as string
            end tell
            set myDate to (word 2 of myDate) & " " & (text 1 thru 3 of word 3 of myDate) & " " & (word 4 of myDate) as string
            -- end find date
            -- checks for the correctly named frames and then populates with the correct information
            if exists (text frame "titleblock-software" of document 1) then
                set contents of text frame "titleblock-software" of document 1 to myFileVersion
            end if
            if exists (text frame "titleblock-client" of document 1) then
                set contents of text frame "titleblock-client" of document 1 to clientFolder
            end if
            if exists (text frame "titleblock-file" of document 1) then
                set contents of text frame "titleblock-file" of document 1 to myFile
            end if
            if exists (text frame "titleblock-path" of document 1) then
                set contents of text frame "titleblock-path" of document 1 to myPath as string
            end if
            if exists (text frame "titleblock-date" of document 1) then
                set contents of text frame "titleblock-date" of document 1 to myDate
            end if
            if exists (text frame "titleblock-editor" of document 1) then
                set contents of text frame "titleblock-editor" of document 1 to myInitials
            end if
            if exists (text frame "titleblock-version" of document 1) then
                set versionCount to get contents of text frame "titleblock-version" of document 1
                set versionCount to (versionCount + 1)
                set contents of text frame "titleblock-version" of document 1 to versionCount
            end if
            -- end populating named frames
        end tell
    end if
    -- this handler is to get the version of the file
    on getVersion(added_item)
        set myFileVersion to long version of (info for added_item)
    end getVersion
    -- this handler converts every 'odd' character to an underscore, modify as needed
    on cleanName(newName)
        set chars to every character of newName
        repeat with i from 1 to length of chars
            if item i of chars as text is equal to "_" then
                set item i of chars to " "
            end if
        end repeat
        return every item of chars as string
    end cleanName

  • Sql loader:loading data file name to one of the tabe column.

    Hi,
    I want to load the data file name also to one of the table column.
    Table structure:
    File_Name varchar2
    Name varchar2
    Age number
    Data File Format:
    Vijay|24
    Anandh|24
    Senthil|26
    In the above eg how to write a control file to load the data file name to the File_Name column of the table.
    Note:
    The shell script will first pick up the data files to be loaded and calls the control file.
    Thanks,
    Vijay.

    From a unix load perspective this is what we have done :
    Create a control file (say load_data.ctl) something like
    LOAD DATA
    append
    Into table file_name_age
    File_Name constant '<FILENAME>',
    Name CHAR TERMINATED BY '|'
    Age INTEGER EXTERNAL TERMINATED BY '|' )
    in a unix loop do the following
    for i in `ls $LOADDIR` ; do
    #Replace <FILENAME> with actual filename and create a temp ctl file
    sed s/\<FILENAME\>/${1}/g < ${CTLDIR}/load_data.ctl > ${TMPDIR}/load_data_${1}.ctl
    #load using temp file
    sqlldr / CONTROL=${TMPDIR}/load_data_${1}.ctl
    DATA=$i
    #remove temp
    rm ${TMPDIR}/load_data_${1}.ctl
    done
    Where
    ${TMPDIR}=your temp directory
    ${CTLDIR}=where your main directory for ctl files
    $LOADDIR=Your data directory

  • Possibility of capturing data file name in SQL * Loader

    Hi,
    I have a requirement to capture the data file name in the staging table, is there a way that i can capture it in SQL * Loader or any other way of doing it.
    Need experts suggestion please.
    Thanks,
    Genoo

    Hi Genoo.
    how do we capture the file name and stores in the temporary table
    You may use the above command mentioned in my previous post (if Linux) to populate the Test.csv file with the available file name in the directory, i.e:
    ls /some/path/*.dat | xargs -n1 basename  > /home/oracle/Test.csv
    1. Ensure to first load the Test.csv file as for eg:
    1,aaa
    2,bbb
    3,ccc
    2. Create a control file to load these records into temporary tables,for eg:
    load data
    infile '/home/oracle/Test.csv'
    into table file_name_upload
    fields terminated by ","
    ( id, file_name )
    3. Create the respective table in the database:
    create table file_name_upload
      id number,
      file_name varchar2(20)
    4. Load the data into temporary table
    sqlldr test/test control=/home/oracle/sqlldr_test.ctl
    Please refer notes:
    SQL*Loader - How To Load A Date Column With Fractions Of Second (Doc ID 1276259.1)
    Script To Generate SQL*Loader Control File (Doc ID 1019523.6)
    SQL*Loader performance tips (Doc ID 28631.1)
    How To use the Sequence Function of SQL*Loader (Doc ID 1058895.6)
    How to Get Data from Existing Table to Flat File Usable by SQL*Loader (Doc ID 123852.1)
    Also see link:
    10 Oracle SQLLDR Command Examples (Oracle SQL*Loader Tutorial)
    Thanks &
    Best regards,

  • Exporting USER along with data

    Hi there,
    Is it possible to export User along with data. I have 5 tables which belong to user DEVELOPER. I want to EXP this user with 5 tables.
    When I run the IMP, it errors out saying USER does not exist.
    I use like USERID=SYSTEM/MANAGER FULL=Y or I tried also with FROMUSER=DEVELOPER , TOUSER=DEVELOPER
    I can get away from this error by pre-creating DEVELOPER user but what if I have 20 users with their data.
    Is it possible that IMP will create user first and then import the data?
    I am using Oracle 9i on Windows.
    Thanks,
    Data Sheet

    Hey,
    Try the URL below -
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch01.htm#1006280
    Example to export an user using command line:
    $exp system/pasword FILE=scott.dmp OWNER=scott GRANTS=y ROWS=y COMPRESS=y
    or
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch02.htm#1005864
    Example to import an user using command line:
    $imp SYSTEM/password FILE=scott.dmp FROMUSER=scott TABLES=(dept,emp)
    I hope this can help you,
    Best Regards,
    Marcello

  • Displaying images along with data on downloading from excel

    Hi All,
    I need to show images along with data in the excel sheet when user clicks downld to excel button.  Is there possible way to show the images in excel sheet if, kindly help.
    Thanks & Regards
    Jaspreet Kaur

    Hi Vinod
    Basically I have a report which needs to be downloaded to excel sheet. For each record there is a particular image in the first column for ex say my colums are img, desc.  Now image column contains an image corresponding to each description.  If its a file, a folder image is there; if its a document, a page image is there etc.  Now i am can display the data of  text fields  in the following manner ie label =new Label(0,RowCount, wdContext.nodeVn_PortalExcel().getVn_PortalExcelElementAt(i).getVa_Role(), PortalRoleDataFormat);
    PortalReportsheet.addCell(label);
    but how do i display the image in the excel sheet?
    Is it possible to do so, if so please provide assistance.
    Thanks & Regards
    Jaspreet Kaur

  • SQL*Loader to insert data file name during load

    I'd like to use a single control file to load data from different files (at different times) to the same table. I'd like this table to have a column to hold the name of the file the data came from. Is there a way for SQL*Loader to automatically do this? (I.e., as opposed to running an update query separately.) I can edit the control file before each load to set a CONSTANT to hold the new data file name, but I'd like it to pick this up automatically.
    Thanks for any help.
    -- Harvey

    Hello Harvey.
    I've previously attempted to store a value into a global/local OS variable and use this within a SQL*Loader control file (Unix OS and Oracle versions between 7.3.4 and 10g). I was unsuccessful in each attempt and approach I could imagine. It was very easy to use a sed script to make a copy of the control file, changing a string within it to do this however.
    Do you really want to store a file name on each and every record? Perhaps an alternative would be to use a relational model. Create a file upload log table that would store the file name and an upload # and then have the SQL*Loader control file call a function that would read that table for the most recent upload #. You'll save some disk space too.
    Hope this helps,
    Luke

  • Data Display table along with Graph

    As per my knowledge we are not having any option currently for displaying data table along with graph.
    This plot data table can have plot name along with current data.
    See the sample below. Many times I need to display number of parameters on graph and current value need to see along with graph.
    It will very useful if I get something like this in next version.

    Hi chameli,
    well, you gave the chart as an example to your question - but didn't specify your question any further!
    What's wrong with a little coding to have your data presented as you like to?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to show timestamp along with date in LOV dropdown

    Hi,
    We have a requirement to show timestamp along with date as a display column in a LOV drop down. Type of the date column in VVO is set to timestamp. But still it is showing only date in the UI.
    But it is showing timestamp when we run it through AM. Is there any thing in to do in addition to display it in UI? Or it is not feasible? Please suggest me on this issue.
    Thanks in advance.
    Thanks,
    Santhosh

    The date format displayed in UI depends on applcore preference set for current user, try changing date format set for current user to include time along with date.

  • Insert data file name into table from sql loader

    Hi All,
    I have a requirement to insert the data file name dynamically into table using sql loader.
    Example:
    sqlldr userid=username/passwword@host_string control=test_ctl.ctl data=test_data.dat
    test_ctl.ctl
    LOAD DATA
    FILED TERMINATED BY ','
    INTO TABLE test
    (empid number,
    ename varchar2(20),
    file_name varchar2(20) ---------- This should be the data file name which can be dynamic (coming from parameter)
    test_data.dat
    1,test
    2,hello
    3,world
    4,end
    Please help..
    Thanks in advance.
    Regards
    Anuj

    you'll probably have to write your control file on the fly, using a .bat or .sh file
    rem ===== file : test.bat ========
    rem
    rem ============== in pseudo speak =============
    rem
    rem
    echo LOAD DATA > test.ctl
    echo FILED TERMINATED BY ',' >> test.ctl
    echo INTO TABLE test >> test.ctl
    echo (empid number, >> test.ctl
    echo ename varchar2(20), >> test.ctl
    echo file_name constant %1% >> test.ctl
    echo ) >> test.ctl
    rem
    rem
    rem
    sqlldr userid=username/passwword@host_string control=test.ctl data=test_data.dat
    rem =============== end of file test.bat =======================
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1008664

  • Migrate SQL 2008 Analysis database to 2012 AS database along with data level security defined in current production cube

    I want to migrate Analysis Services 2008 database to 2012 AS database along with data level security defined in current production cube
    Note: Only Production environment have security, while no security is defined in development environment
    Potential Approach:
    1 - Using Synchronization Wizard: Gives me error : "The OLAP element at line1 can not appear under envelope......" and this is because Synchrinzation works only for same version
    and in my case, there are different versions of SQL (SQL 2008 and 2012)
    2 - Using Visual studio conversion wizard - Convert SQL 2008 AS project to 2012 and then process cube, so I can get the cube working but then how can I get data level security since 100's of data level security is defined in production Cube, so how can I
    migrate that across
    3 - Script out XMLA and deploy cube - But then again having issues with how can i script SSAS security
    4 - Would taking backup of SSAS 2008 database and restore to SSAS 2012 will help ?
    Any suggestions would be appreciated
    Thanks,
    Mihir

    Hi Mihir,
    According to your description, you want to migrate the SQL Server Analysis Services (SSAS) 2008 database which have some security setting with it to SSAS 2012, right? We can migrate existing Analysis Services databases either during Setup, by upgrading an
    existing instance of Analysis Services, or after Setup, by running the Migration Wizard. Generally, when migrating a database to another server, all the setting will be migrated. So in your scenario, you can refer to the steps on the links below to migrate
    your SSAS database.
    How to: Migrate Analysis Services Databases
    Migrating Existing Analysis Services Databases
    Regards,
    Charlie Liao
    TechNet Community Support

  • Quicken data file names are mysteriously being change on my iDisk

    within the last couple of days my Quicken data file names are mysteriously being change on my iDisk which seem to make them inaccesable.  Not sure why this is happening

    within the last couple of days my Quicken data file names are mysteriously being change on my iDisk which seem to make them inaccesable.  Not sure why this is happening

Maybe you are looking for

  • Displaying encripted pages

    I'm using two form pages on a web site. Both forms are scripted server side and I have linked them through my hosting companies secure server - the remaining four pages on the site are unencrypted. On cross browser testing, the results are as follows

  • USER EXIT or BADI  to add custom fields in QI06 Output

    Hi Gurus, I have tried to find out Suitable User Exit / BADI to add custom fields in QI06 ( Collective Maintenance Display) output. but in vain.. We found USer Exits -QLIB0001/QLIB0002 . Badi- QB_PLAN_SELECTION_P, QB_Q_INFO_RECORD,QB_QM_SYSTEM_COMPAR

  • Is there a way to reverse batch renaming in Bridge?

    Unfortunately I accidently renamed files with a "." in the file rename. This caused all my images to have an odd file type which then makes them unreadable. Help!!! Any suggestions of what to do?

  • How to retrieve answers to secret questions on iPad

    I've forgotten the answer to 1 of my secret question how to retrieve it?

  • Can a Mac with OS X 10.4 remove all traces of prior ownership?

    I inadvertently posted this earlier to the OS X 10.5 Leopard board. Got a solution for 10.5, but alas this machine is an oldie and will only handle OS X 10.4. Read on ... I have a many-years-old 600 MHz PowerPC G3 iMac (Snow White) that I'm planning