Import from CSV file into oracle using pl/sql - sql loader 3.1

Hello

I am trying to learn how to import a CSV file in an oracle table. I tried the import utility in SQL Loader, but it generates specific lines of code to import each line. I would like a loop to go through the CSV file stored on my local disk and transferred it to my table.

I tried the following, but not luck
DOWNLOAD THE DATA
INFILE 'sample_csv.csv '.
IN THE TEST TABLE
FIELDS TERMINATED BY ', '.
;

951716 wrote:
Hello

I am trying to learn how to import a CSV file in an oracle table. I tried the import utility in SQL Loader, but it generates specific lines of code to import each line. I would like a loop to go through the CSV file stored on my local disk and transferred it to my table.

line-by-line is slow by slow.
PL/SQL will be NEVER faster than simple SQL
INSERT INTO MYTABLE SELECT * FROM EXTERNAL_TBL;

http://www.orafaq.com/wiki/External_table

Tags: Database

Similar Questions

  • import a csv file into AddressBook

    I'm migrating from outlook to Thunderbird. Import all the emails and addresses does not work. So I exported by e-mail addresses from my server to a csv file. I imported the csv file into Thunderbird. I have to OK the addresses import. Is it possible to import in one click

    If you export all your contacts in a single csv file, you should be able to import the file in a single step, although you may need to edit the csv file before you do:

    https://support.Mozilla.org/en-us/questions/1012084

  • Performance problem when downloading the CSV files into Oracle tables

    We have implemented the Vikas solution ([http://htmldb.oracle.com/pls/otn/f?p=38131:1]) to download CSV files into tables Oracle permanent and it works fine. However, whenever we try to send more than 5,000 records, it takes a lot of time and often wait times. What can we do to improve performance? We are running HTMLDB 2.0.

    For example, a CSV file with 12000 documents and 40 columns takes 40 minutes to load (while a recording of CSV 2000 file takes 2 minutes to load).

    For large external files, copy us our CSV files to the Oracle server and then make reference to the file in an Oracle external table. Once the external table defined you then load your APEX table via a stored procedure by using:

    INSERT INTO your_tbl (columns)
    SELECT (columns)
    Of external_tbl

    Hope that gives you another option to consider.

    Jeff

  • load data from csv file into table

    Hello

    I'm working on Oracle 11 g r2 on UNIX platform.

    We have an obligation to load data to the table to a flat file, but on one condition, need to make the comparison between filed primary key if the file is available then update another filed and if the recording is not available, we need to insert.

    How can achieve us.

    SQLLoader to load the CSV file data into a staging Table.

    Then use the MERGE SQL command to the lines of insert/update of table setting for the target table.

    Hemant K Collette

  • Several Variables import from CSV file

    Hello PowerCLI Masters!

    I've been dabbling in PowerCLI now for about 6 months, especially for larger deployments VM.  I've been tweaking my scripts to automate more over time.  I started with setting all the variables manually and just import the virtual machine to a txt file names, then created several loops in a single script that would incorporate different text files, depending on model, data store, disc sizes VLAN, etc..

    I think that the next step here is to import variables by vm (essentially, a line of a CSV file).  We receive our demands for construction as a spreadsheet, so it would be relatively easy to fill in the correct fields in a spreadsheet and run a script that will import values.  I can't seem to put on the right track with the simple search, so I thought I'd post it here and see if:

    1. someone already did and can provide guidance

    2. can someone put me on the right track to how I would go all this

    3. someone tell me that it is not possible (in the hope that it does not go down like that, but it is certainly possible)

    This IS JUST a SAMPLE of the SCRIPTS - may or may not have a syntax perfect at this stage...

    # SET VARIABLES #.

    $vmname = get-content C:\PowerShell\serverlist_1.txt
    $vmname | {foreach-object
    $vmname = $_

    $templatename = "TMPLT-GSI.
    $folder = "GSI".
    $date = get-Date - uformat "%Y %m %d '.
    $expdate = "20110930".
    $reqno = "00034.
    $sysowner = "GSI".

    $esxhost = "esxhost1.test.com".
    $datastore = "DATASTORE_1".

    $cpu = 1
    $mem = 4096
    $datadrive1 = 26214400

    $datadrive2 = 52428800
    $pgname = "ECOM_902".

    #

    # BUILD/CONFIGURE VM #.

    #

    New-VM - vmhost $esxhost - name $vmname - model $templatename - Datastore $datastore - thick DiskStorageFormat - location $folder

    New-disk-hard - vm $vmname - CapacityKB $datadrive1
    New-disk-hard - vm $vmname - CapacityKB $datadrive2
    Get-VM-name $vmname | $mem set-VM - MemoryMB - NumCPU $cpu - confirm: $false
    Get-networkadapter $vmname | together-networkadapter - networkname $pgname - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "creation Date" - value $date - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name 'expiry Date' - value $expdate - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "Application number" - value $reqno - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "Proprietary system" - value $sysowner - confirm: $false

    }

    So, rather than setting these values in the script, I want to shoot them from a spreadsheet that looks like this (a partial list at condition of course):

    $vmname$templatename$cpu$mem$pgname$datadrive1$datadrive2
    Testdeploy001TMPLT RHEL614'ECOM_902 '.2621440052428800
    Testdeploy002TMPLT-2008_ENT_6428'ECOM_902 '.26214400104857600
    Testdeploy003TMPLT-2008_ENT_6428'ECOM_906 '.26214400104857600


    Thanks in advance for any help provided!

    -Brent

    vmname TemplateName central processing unit MEM pgname datadrive1 datadrive2 folder
    Testdeploy001 TMPLT RHEL6 1 4 'ECOM_902 '. 26214400 52428800 GSI
    Testdeploy002 TMPLT-2008_ENT_64 2 8 'ECOM_902 '. 26214400 104857600 GSI
    Testdeploy003 TMPLT-2008_ENT_64 2 8 'ECOM_906 '. 26214400 104857600 GSI

    I would do something like this:

    $date= Get-Date -uformat "%Y%m%d"
    $expdate="20110930"
    $reqno="00034"
    $sysowner="GSI"
    $esxhost="esxhost1.test.com"
    $datastore="DATASTORE_1"
    
    Import-CSV C:\PowerShell\serverlist.csv | Foreach {
     New-VM -vmhost $esxhost -Name $_.vmname -Template $_.templatename -Datastore $datastore -DiskStorageFormat thick -Location $_folder
     New-Harddisk -vm $_.vmname -CapacityKB $_.datadrive1
     New-Harddisk -vm $_.vmname -CapacityKB $_.datadrive2
     Set-VM -VM $_.vmname -MemoryMB $_.mem -NumCPU $_.cpu -Confirm:$false
     get-networkadapter $_.vmname | set-networkadapter -networkname $_.pgname -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Creation Date" -Value $date -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Expiration Date" -Value $expdate -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Request Number" -Value $reqno -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "System Owner" -Value $sysowner -Confirm:$false
    }
    
  • Import a CSV file into a table

    Hello

    I followed this example to download the CSV file in table in the database.
    http://avdeo.com/2008/05/21/uploading-Excel-sheet-using-Oracle-Application-Express-apex/

    It seems that no file is saved in this table - wwv_flow_files

    When I run the procedure laid down in the above example, I get error "No data found".
    Please, help me.

    I use Oracle Apex version 4.0.2

    Thank you!

    See my sample application

    http://Apex.Oracle.com/pls/Apex/f?p=51467:1:3854972221692354:no:

    user: test password: test

  • How to load the date and time from text file to oracle using sqlloader table

    Hi friends

    I need you to show me what I miss loading date and time text file in a table oracle using sqlloader

    It's my data in this way (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,30
    my table in the database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);
    the code for the control in this path (c:\external\ctrl.ctl) file
    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 that I enjoyed

    Thank you

    Published by: user10947262 on May 31, 2010 09:47

    load data
    INFILE 'C:\external\my_data.txt '.
    in the table emp2
    fields completed by «,»
    (empno, ename, hiredate, etime, Elysa, 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:\>
    

    This isn't a mistake, you can see errors in the log file and bad.

  • Load the XML file into oracle using sql loader

    Hello

    I'm trying to load an xml file into a table using sqlldr.
    I have a table as follows:
    CREATE TABLE xmlloadtable
    ( id number,
     data_xml XMLType
     )
      XmlType data_xml STORE AS CLOB;
    I have a control file that I know is perfectly false:
    LOAD DATA 
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable 
    (
    id,
    data_xml 
    )
    I googled for the file control and tried in different ways, but of no use.
    I want to load the entire xml file into the table.
    Can someone help me with the correct control file. Any help is appreciated!

    Try this

    LOAD DATA
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable
    (id,
     file_name          filler,
     data_xml          lobfile(file_name) terminated by eof
    )
    

    You can add the file as a column name field to your table between the id and xml column and remove the word to fill in the .ldr file if you need to keep the name of the file

  • How to create a Shell (.sh) file in Oracle using PL/SQL?

    Hello world

    I would like to know how to create a .sh file or any .txt file in Oracle. I would like to get the contents of the file from a table that has different settings. I used bcp in SQL Server and wonder if it's possible in Oracle to create this file.

    Here are the DDL and DML in the table:

    Hello

    With a minor correction, it works on Unix/putty:

    -I assume that you have already created the DIRECTORY (line 01); my directory is on Unix "/ tmp"-you can use on Windows

    CREATE the DIRECTORY DEST_DIR AS 'C:\Users\Julaayi\Desktop\ ';

    -You run SELECT in a variable (ctlCode) and output then the content of this variable in your file.

    -If you have multiple records in the ETL_CTL table, and then use a FOR LOOP.

    CREATE DIRECTORY XX_DIR AS '/tmp/';
    --
    DECLARE
      fileHandler UTL_FILE.FILE_TYPE;
      ctlCode varchar2(2000);
    BEGIN
      fileHandler := UTL_FILE.FOPEN('XX_DIR', 'test_file.sh', 'W');
      select 'scp abcdf@'|| SOURCE_SERVER_1 ||':'|| SOURCE_PATH_1 || EUROPE_1 || EUROPE_NAME
            ||' ' || DEST_SERVER || DEST_PATH || DEST_EUROPE_1
      into ctlCode
      from ETL_CTL;
      UTL_FILE.PUTF(fileHandler, ctlCode);
      UTL_FILE.FCLOSE(fileHandler);
    EXCEPTION
      WHEN utl_file.invalid_path THEN
        raise_application_error(-20000, 'ERROR: Invalid PATH FOR file.');
    END;
    /
    
  • Import Excel file into oracle Apex table

    Hello

    using the Application Express 4.2.5.00.08

    Oracle 11g.

    My question is how do I import data into oracle using the APEX of EXCEL file table please? Any other file format.

    Thank you very much

    RI

    Irha10 wrote:

    using the Application Express 4.2.5.00.08

    Oracle 11g.

    My question is how do I import data into oracle using the APEX of EXCEL file table please? Any other file format.

    Use plug-ins Excel2Collections.

  • Anyone has any experience of importing a csv file and store it in a database in MS SQL

    Anyone has any experience of importing a csv file and store it in a database MS SQL. Outside sql injection there is any another converns security?

    Draft of the steps.

    1. use to download the file from the client to the server see
    http://www.dennismiller.TV/index.cfm/2007/12/26/file-upload-using-ColdFusion-and-Flex

    2. use to read the contents of the file into a variable.

    3. perform a loop on the content of variables for each line, dealing with the variable as a list delimited by a newline rather then a comma

    4. use list functions on each line to get the data you need, and then to transmit these data to SQL with CFQUERY or CFPROCPARAM.

  • A query when importing an XML file into a database Table

    Hello
    I create an ODI project to import an XML file into a database using the following link Table.With

    http://www.Oracle.com/WebFolder/technetwork/tutorials/OBE/FMW/ODI/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
    I am facing a problem when creating physical Schema for the XML Source model.
    For the
    Schema (Schema)
    and
    Schema field (scheme of work) that they have chosen to GEO_D.
    What GEO_D here?
    or
    What should I select here?
    (1) the XML schema (NB:-J 'I havn' t created any file .dtd for my file .xml or .xsd)
    or
    (2) my diagram of target servers
    Please tell me what I do?
    Thank you

    and
    Schema field (scheme of work) that they have chosen to GEO_D.
    What GEO_D here?

    Is the schema specified in the XML file name.

    What should I select here?
    (1) the XML schema (NB:-J 'I havn' t created any file .dtd for my file .xml or .xsd)

    Yes

    (2) my diagram of target servers
    Please tell me what I do?
    Thank you

  • import an audio file instead of using micro

    in the future, it will be possible to import an audio file instead of using micro for the lip sync?

    It is already possible to synchronize lips without using a microphone. Import a file (File/Import) a wav or aiff. Drag it into the scene. Select the puppet that you want to synchronize lips. Then click on timeline/Compute Lip Sync audio of the scene.

    You can also play audio files on your computer and, if the system audio hardware preferences are configured correctly, lip sync that activating the microphone.

  • How can I import an excel file into an already existing form on the PDF (via AdobePro)?

    How can I import an excel file into an already existing form on the PDF (via AdobePro)? No data just directly, drop-down lists.

    Hi spencert3881156,

    Please post on the Adobe forums.

    You can visit the following link on the same thread:

    Can I import data from an Excel worksheet to a PDF form? (Create PDF)

    Let me know if this helps.

    Kind regards

    Ana Maria

  • How to import an excel xls file to oracle database PL/SQL?

    Hello, im having problems to import a xls file to oracle, someone knows an easy way or a script to import this database file? THX!

    Hello

    have converted your excel to CSV, convert csv, you must save the file as option Save as fall to the bottom of the list select CSV Comma-delimited. then try

Maybe you are looking for