SQL* Loader Loading specific column from CSV file to the table

Dear All,
Iam Loading specific column from .CSV file to the oracle table.
Could pls help how i can load only that cols into the table
Eg: CSV file having id, Frst_name,Last_name, Address,Phone,Insurance etc
out of this I want to load only Frst_name,Last_name columns to oracle table say fname and lname.
Thanks in Adv.
Junu

Lily,
I made some changes to your table def but you will get the idea
-- Table EMPLOYEE
CREATE TABLE EMPLOYEE
  EMPID        NUMBER                           NOT NULL,
  EMPNICKNAME  VARCHAR2(10 BYTE)                    NULL,
  FNAME        VARCHAR2(20 BYTE)                NOT NULL,
  MI           VARCHAR2(20 BYTE)                    NULL,
  LNAME        VARCHAR2(20 BYTE)                NOT NULL,
  FULLNAME     VARCHAR2(20 BYTE)                NOT NULL,
  HIREDATE     DATE                             DEFAULT SYSDATE               NOT NULL
--  data file employee.dat
1,amy,b,amy b
2,cindy,d,cindy d
3,eric,f,eric f
4,gary,h,gary
-- Control file : Employee.ctl ( you can use truncate, replace or append , see sqlldr for more options)
load data
Truncate into table employee
fields terminated by ","
optionally enclosed by '"'
TRAILING NULLCOLS
empId INTEGER EXTERNAL,
FName char(20),
LName char(20),
FullName char(30)
now to load use following or you can speicify infile in control fle
sqlldr username/passowrd control=employee.ctl  data=employee.dat log=employee.log
{code}
Hope this help.
Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Issue in loading specific columns from a file to teradata table using IKM

    Hi,
    Can any one help to resolve the issue in loading specific columns from text file to teradata table.
    i tried using IKM file teradata and columns are getting displaced.
    my requirement suppose i have 5 columns in file and i have to load only 3columns to table using IKM.
    same thing can be achived using LKM file to teradata but i want use IKM.
    please suggest me on this
    Regards
    Vinod

    Hi,
    I believe that the problem you are having is that you have a delimited file, of which you want to pick columns from position 2,3,5. In this case, ODI will pick the first 3 columns of a delimited file regardless of position.
    For example, if you a tab delimited file with c1,c2,c3,c4,c5 columns, and you want only columns c2,c3,c5 - when mapping these in an ODI interface, and executing, you will actually pick up the data from c1,c2,c3 as these are the first three columns in the file (reading from left to right). You can ignore "columns" on the right hand side of a file, but not the left. E.g delimited file with c1,c2,c3,c4,c5. Only pick columns c1,c2 will give you data for the first 2 columns
    Create a temporary table to load all the data from the file, and use you temp table to extract the data you require. Or you could get the file created with the first three columns as the columns you require.
    Cheers
    Bos
    Edited by: Bos on Jan 18, 2011 1:06 PM

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

  • Loading data from .csv file into Oracle Table

    Hi,
    I have a requirement where I need to populate data from .csv file into oracle table.
    Is there any mechanism so that i can follow the same?
    Any help will be fruitful.
    Thanks and regards

    You can use Sql Loader or External tables for your requirement
    Missed Karthick's post ...alredy there :)
    Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM

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

  • Failed to read data from report file Reason: The table could not be found.

    BO Enterprise XI R2, cannot publish crystal reports using the publishing wizard.
    Failed to read data from report file Reason: The table could not be found.
    Any ideas to get around this would really help out.
    Regards

    Connection used Views, ODBC System DSN is setup properly.
    Approach for import from business view manager and import wizard.  both methods failed to import the Business View and underlying reports.
    I figure I may have imported the Business View wrong? From Business View Manager I exported from my dev server then imported to prod server.
    Apparently I learned exporting my business view also includes the Data Connections that the Business Views are dependent upon.
    So which ever folder you specify it copies it there. Originally the all Data Connections Resides on the root folder. To return it to the original location. I deleted what I had exported. Exported this time to the root folder, then only deleted the business views, foundation, elements. Then exported again to the folder where I intended then only deleted the Data Connection.
    Makes any sense? So I then had to re point the business views and all the dependent objects to the data connection that resides in the root folder.
    I tested the connection, it works fine. I properly updated my crystal reports to the business view in production. Did a sample extract it works as expected.
    However when i try to publish, either from Crystal or Publish wizard i get the same error?
    As a work around i am thinking, after updating the business view in the crystal reports, shall i re map the fields?? or reexport the business views again?
    Any help will be surely appreciated.

  • Loading data from .csv file into existing table

    Hi,
    I have taken a look at several threads which talk about loading data from .csv file into existing /new table. Also checked out Vikas's application regarding the same. I am trying to explain my requirement with an example.
    I have a .csv file and I want the data to be loaded into an existing table. The timesheet table columns are -
    timesheet_entry_id,time_worked,timesheet_date,project_key .
    The csv columns are :
    project,utilization,project_key,timesheet_category,employee,timesheet_date , hours_worked etc.
    What I needed to know is that before the csv data is loaded into the timesheet table is there any way of validating the project key ( which is the primary key of the projects table) with the projects table . I need to perform similar validations with other columns like customer_id from customers table. Basically the loading should be done after validating if the data exists in the parent table. Has anyone done this kind of loading through the APEX utility-data load.Or is there another method of accomplishing the same.
    Does Vikas's application do what the utility does ( i am assuming that the code being from 2005 the utility was not incorporated in APEX at that time). Any helpful advise is greatly appreciated.
    Thanks,
    Anjali

    Hi Anjali,
    Take a look at these threads which might outline different ways to do it -
    File Browse, File Upload
    Loading CSV file using external table
    Loading a CSV file into a table
    you can create hidden items in the page to validate previous records before insert data.
    Hope this helps,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • Loading records from .csv file to SAP table via SAP Program

    Hi,
    I have a .csv file with 132,869 records and I am trying to load it to an SAP table with a customized SAP program.
    After executing the program, only 99,999 records are being loaded into the table.
    Is there some setting to define how many records can be loaded into a table? Or what else could be the problem?
    Pls advice.
    Thanks!!!

    hi Arun ,
    A datasource need a extract structure to fetch data .It is nothing but a temp table to hold data.
    First you need to create atable in SE11 with fields coming from CSV file.
    Then you need to write a report program to read you CSV file and populate your table in BW .
    Then you can create a datasource on top of this table .
    After that replicate and load data at PSA and use to upper flow.
    Regards,
    Jaya Tiwari

  • Data Migration from CSV file to Database Table.

    Hi,
    I have checked few answered threads on Data Migration Issues but didn't find the solution yet.
    I am reading data from an CSV file to internal table but the complete row is coming under one field of the internal table.
    How i can get values in different fields of the internal table from the CSV file ?
    Thanks & Regards.
    Raman Khurana.

    Hi,
    If you are using GUI_UPLOAD, you might have missed to make has_field_separator  as 'X'.
      EXPORTING
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       filename                      = 'C:\File.csv'
       filetype                      = 'ASC'
       has_field_separator           = ' X'  "<= Set this as 'X'.
      TABLES
        data_tab                      = itab.
    Regards,
    Manoj Kumar P

  • Exporting specific columns from XLS file to a new XLS or XLSX file using powershell

    The scenario is that i have a file that our server is constantly dumping data to on a daily basis and out of all the data i only need 2 columns. I need to be a able to automate this because i need to generate a monthly report based on those two columns.
    That being said, i need to be able to extract two full columns from datafile1.xls to newdatafile.xlsx. If it would be easier if the original file is CSV i can easily save the data in CSV format instead of XLS. 
    Thanks in advance.

    I see, im having a hard time executing the script, i keep getting the following error:
    '""Microsoft.Jet.OLEDB.4.0"
    has not been registered.";' 
    and
    when i try to run it like this i dont get any errors BUT nothing happens:
    C:\Windows\syswow64\rundll32.exe "C:\Program Files\Common Files\System\Ole DB\oledb32.dll",c:\temp\t.ps1
    This is the code, which to tell you the truth im not really that familiar with :\
    $strFileName = "C:\temp\original\styles.xls"
    $strSheetName = 'STYLES$'
    $strProvider = "Provider=Microsoft.Jet.OLEDB.4.0"
    $strDataSource = "Data Source = $strFileName"
    $strExtend = "Extended Properties=Excel 8.0"
    $strQuery = "Select STYLE CODE , LAST UPDATE from [$strSheetName]"
    $objConn = New-Object System.Data.OleDb.OleDbConnection("$strProvider;$strDataSource;$strExtend")
    $sqlCommand = New-Object System.Data.OleDb.OleDbCommand($strQuery)
    $sqlCommand.Connection = $objConn
    $objConn.open()
    $DataReader = $sqlCommand.ExecuteReader()
    While($DataReader.read())
    $ComputerName = $DataReader[0].Tostring()
    "Querying $computerName ..."
    Get-WmiObject -Class Win32_Bios -computername $ComputerName
    $dataReader.close()
    $objConn.close()
    For both PowerShell or VBScript you are missing the libraries.  You need to download and install the ACE drivers.
    Search for ACE drivers.
    ¯\_(ツ)_/¯

  • Problem importing specific data from .csv file

    Hello!
    I'm using JDev 11.1.3.0 with JSF ui and I've been following the excellent example about importing comma separated values from a .csv file, of Mr. Bors, but I have a specific problem...
    1) When i try to import a date value (format dd/mm/yyyy) to a date field of my adf table, the date won't be accepted and it's not shown (I'm using Row.setAttribute("Field", textValue) for that purpose). I guess I have to enter it in a specific format but don't know how!
    2) Same thing with double values. Tried 1.50 and it's showing on the adf table 0.02. Tried 1,50 (with a different text separator) and it's throwing me an error and doesn't show anything on the table (again i'm using Row.setAttribute("Field", textValue) for that one too)...
    Any help would be appreciated!
    Thank you
    Edited by: Nikolas Saridakis on 6 Νοε 2010 11:10 πμ

    I tried your suggestion before I set my question but didn't know if I was looking on the right direction (I tried some things but they didn't work out). After a bit poking everything was fine...
    So I used
    Row.setAttribute("Field_name", oracle.jbo.domain.Date.fromText(value, "dd/mm/yyyy", null));
    and it did the trick...
    Weird thing about numbers was that after that, they were entered properly on the table with a normal Row.setAttribute("Field_name", value); with value being a String... anyway!
    Thank you Timo!

  • How to import data from CSV file into a table by using oracle forms

    Hi,
    I have a CSV file and i want to insert in oracle database in a table by using a button in oracle forms.
    the user can select CSV file by using open dialog .
    can any one help me to find method to make import and select file from the client machine ?
    thx.

    1. create table blob
    CREATE TABLE IB_LOVE
      DOC          BLOB,
      CONTRACT_NO  VARCHAR2(20 BYTE)                NOT NULL
    )2. use the code below to insert:
           INSERT INTO ordmgmt.ib_love
                       (contract_no, doc
                VALUES (:control.contract_no_input, NULL
           lb$result :=
             webutil_file_transfer.client_to_db (:b2.file_name, v_file_blob_name, v_col_blob_name,
                                                 'CONTRACT_NO = ' || :control.contract_no_input);
           :SYSTEM.message_level := 25;
           COMMIT;
           :SYSTEM.message_level := 0;3. use the code below to download
         if :control.CONTRACT_NO_INPUT is not null then
              vboolean :=   webutil_file_transfer.DB_To_Client_With_Progress(
                               vfilename,  --filename                       
                              'IB_LOVE', ---table of Blob item                       
                              'DOC',  --Blob column name                       
                              'CONTRACT_NO = ' || :CONTROL.CONTRACT_NO_INPUT, ---where clause to retrieve the record                       
                              'Downloading from Database', --Progress Bar title                       
                              'Wait to Complete'); --Progress bar subtitle  client_host('cmd /c start '||vfilename);
              client_host('cmd /c start '||vfilename);                 
         else
              errmsg('Please choose contract no');
         end if;4. use the code below to open file dialog
    x:= WEBUTIL_FILE.FILE_OPEN_DIALOG ( 'c:\', '*.gif', '|*.gif|*.gif|', 'My Open Window' ) ;
    :b2.FILE_NAME:=X;

  • Trigger while importing from .csv file

    hey
    i am importing data from .csv file into a table called temp.
    .csv file is having column sales. the data in that also contains some empty filed or N/A or -
    sales coulmn in my table is NUMBER.
    so while importing some column are not able to import.
    how to write a trigger to eliminate '-' or 'N/A' or ' ' values from the sales column before inserting into the table

    It might be easier if the field on temp was a varchar2 field instead?
    The values entered should be loaded into this field and you can then use the trigger to test the values and convert these into numbers or nulls before inserting onto the proper data table.
    Check out the TO_NUMBER() function in SQL for info on how to convert strings to numbers.
    Regards
    Andy

  • How to refer/store  a vaue from csv file in control file

    Hi,
    Consider the following control file script.
    Load data
    infile 'suv.csv'
         append      into table mast_equipmnet_test
    fields terminated by "," optionally enclosed by '"'     
    TRAILING NULLCOLS
    equipment_id,
    sub_vehicle_type,
    ebiz_carrier_no expression "(select ebiz_carrier_no from mast_carrier where carrier_id=?)",
    licence_no,
    equip_type,
    ebiz_appown_no,
    ebiz_equip_no sequence(1,1)
    here is my csv file
    CABNO,          SUBTYPE     CARRIER_ID               REG_NO,     VEHICLE_TYPE,          EBIZ_APPOWN_NO
    6954,          SUMO,          SWAMY,                         6954,          SUV,                    228
    9183,          SUMO,          SWAMY,                         9183,          SUV,                    228
    3173,          QUALIS,          SWAMY,                         3173,          SUV,                    228
    In my csv file i have carrier_ids which are string values in 3rd column.
    for every carrier_id ,the corresponding ebiz_carrier_no(numeric value) is stored in a master table called "mast_carrier".
    While loading the data i need to fetch the ebiz_carrier_no for each carrier_id from mast_carrier table .
    but here i got strucked in the where clause of select statement.
    I am not able to refer the carrier_id from csv file in where clause.
    can any body tell me how to refere a value from csv file in the select statement of control file script.
    cheers
    RRK

    Sorry..
    "EXPRESSION" is not needed..
    ebiz_carrier_no "(select ebiz_carrier_no
    from mast_carrier
    where carrier_id=:ebiz_carrier_no )",
    <br>
    <br>
    "Tested" as
    <br>
    load data
    infile *
    into table t truncate
    fields terminated by ','
    (id,
    name "(select ename from emp
                       where empno = :name)"
    begindata
    1,7900
    2,7902
    <br>
    QL> select * from t;
           ID NAME
            1 JAMES
            2 FORD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Table unable to read data from CSV file

    Dear All,
    I have created a table which have to read data from external CSV file. The table is giving error if the file is not there at the specified location,but when i put the file at that location there is no error but no rows are returned.
    Please suggest what should i do???
    Thanks in advance.

    No version.
    No operating system information.
    No DDL.
    No help is possible.
    I want to drive home the point here to the many people that write posts similar to yours.
    "My car won't start please tell me why" is insuffiicent information. Perhaps it is out of gas. Perhaps the battery is dead. Perhaps you didn't turn the key in the ignition.

Maybe you are looking for