• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6458
  • Last Modified:

PL/SQL program to read data from *.xls file into oracle tables

Hi,

    I have a report data in the form of an   " *.xls "    file. The data in this file is of different languages
( eg:  english, japanese, taiwanese and chinese).

I wrote a ctrl file in PL/SQL to load the data from    *.csv  file into oracle tables and used  'sqlldr' to get my job done

But  Microsoft Excel is troubling us because
When I do save-As the *.xls  file into *.csv (comma seperated value format)
then all the character wrt japanese, taiwanese and chinese etc are lost and they are replaced with junk character like "????".

can U please suggest me

a)  As how to modify my ctrl file

OR

b) write a new PL/SQL program,

so that it can read the data directly from " *.xls "   file into oracle tables without any data corruption ?
( i.e.  It should preserve the characters of different languages when exporting data from *.xls file into oracle tables).

Thankyou,



0
gadenada
Asked:
gadenada
1 Solution
 
konektorCommented:
make sure u used proper character set while loading csv to oracle.

if u use external table using loader do not forget to specify characterset:
CREATE DIRECTORY <your name of directory> as '<path to csv location on database server>';
CREATE TABLE <your table name> (
  <col1>  VARCHAR2(1),
  <col2>  DATE,
  ...
)
organization external(
type oracle_loader
default directory <your name of directory>
access parameters( records delimited by newline characterset <your character set>
skip 0
badfile <your name of directory>:'<your csv filename>.bad'
logfile <your name of directory>:'<your csv filename>.log'
discardfile <your name of directory>:'<your csv filename>.discard'
fields terminated by ';'
enclosed by '"'    
(
  <col1>  CHAR(1),
  <col2>  DATE "YYYY/MM/DD",
  ...
)
) location( <your name of directory>:'<your csv filename>.csv'))
/


if u use sql loader not using external table, make sure that user of operating system has set nls_ parameteter set to proper character set.
0
 
bochgochCommented:
Just to be clear -- you won't load a Excel format file (.xls) created in Excel into Oracle via an external table (or any other method) you must convert to CSV prior to creating the external table, therefore option a) is the way to go.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now