Oracle
  Home arrow Oracle arrow Page 4 - Importing a CSV Text File into Oracle 10G XE
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ORACLE

Importing a CSV Text File into Oracle 10G XE
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 19
    2006-09-26


    Table of Contents:
  • Importing a CSV Text File into Oracle 10G XE
  • Exporting the Employees table from MS Access
  • Importing the EmployeesCsv.csv file into Oracle 10G XE
  • Providing details of the file

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Importing a CSV Text File into Oracle 10G XE - Providing details of the file
    ( Page 4 of 4 )

    The task gets changed as in the next window since you need to provide the details of the file as well as the table properties with a Primary key. By clicking on the Globalization arrow you will see the formatting for the locale. You may also browse to save the file in your My Documents folder. It has already come up with comma as the field separator. You need to choose a character set from a list of options as shown.

    You have chosen the character set, now use the browse button and browse to the EmployeesCsv.CSV  file on the My Documents folder; click on the Next button. 

    This populates the Set Table Properties window as shown. The first item to be chosen is the name of the table. The chosen name for this table is EmployeesCSV. The next four windows show the very large window cut into four pieces and shown in a sequence to cover all the columns (Oracle 10G XE graphics are not easily resized). The EmployeeID has come up with Number data type; the names and titles are with data type Varchar2 with a default size of 30; for the two dates, a format of mm/dd/yyyy has been added; and the 'Photo' column was chosen not to be up loaded.

    The size of the text columns were not altered in anyway. After making these changes, the Next button is clicked. This brings up the window where you need to choose the Primary key and generate a sequence. Sequence is approximately the item that corresponds to the auto increment column. The Primary Key was chosen to be an existing column, namely the EmployeeID as shown. Now you are ready to load. Click on the Load Data button.

    This brings up the next window listing all the activities with the most recent at the top of the list. The table name showing whether the load succeeded or not is shown in the last two columns of this table. As it stands it shows that the last two loads succeeded and the previous two did not. For working with the Oracle 10G XE GUI, please refer to related articles on the DevShed.com site.

    Now go back to the object browser and browse for the newly created table EmployeesCSV in the list of tables as shown.

    The EmployeesCSV table is located in the Tables listing. It shows the design view of the table. Since no changes were made to the data type they all remained in the "as imported" state.

    The data from this import is shown in the next picture. As you can see all the items of the data type "text" have double quotes.

    This next picture is from a previous import which was made into an existing table with a design to mimic the original table using the same CSV file.

    The table design for the NorthEmployees table above was made using the Oracle 10G XE table designer.

    It is important  to have the text qualifier choice in MS Access as double quotes, otherwise in the final load, the columns get scrambled, as shown from a load that did not choose that option.

    Summary

    The load success depends on the correct format of the CSV file. An MS Excel file saved to CSV format successfully produces a file that is easy to load. After bringing in the CSV data changes can be made to the table properties such as changing the data type, format, yes/no load choices and so on, which makes it very flexible. For smaller files the copy and paste option is available. Populating an existing table with CSV file data appears to be easier.



     
     
    >>> More Oracle Articles          >>> More By Jayaram Krishnaswamy
     

       

    ORACLE ARTICLES

    - Oracle's Turn to Play in the Sun
    - Implementing and Using Oracle`s Restore Poin...
    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek