Export Data from Excel to Oracle [message #73327] |
Thu, 25 March 2004 20:30 |
Preeti Gupta
Messages: 1 Registered: March 2004
|
Junior Member |
|
|
Hi,
Can any one help me regarding the matter of Importing Excel sheet data into Oracle by using SQL*Loader Utility or any other utility. I have to pick data from Excel File and slam it to Oracle Database . I have Excel sheet/Table .Also I have to perform validation and in the case of wrong data I have to sent email back to client.
Any help will be appreciated.
|
|
|
Re: Export Data from Excel to Oracle [message #73328 is a reply to message #73327] |
Fri, 26 March 2004 03:13 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
-- first a demo
bash-2.03$ member
SQL*Loader: Release 9.2.0.4.0 - Production on Fri Mar 26 08:11:52 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Commit point reached - logical record count 5
--
-- this is script
-- convert the excel into a csv
-- use sqlldr to load the csv
-- create the proper structure in table
-- do the load
-- trap the errors into a bad file
-- after load if there are any erros in bad file mail them to a person.
--
bash-2.03$ cat member
#!/usr/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/9.2.0
export PATH=$PATH:$ORACLE_HOME/bin
sqlldr userid=mag/mag control=member.ctl bad=member.bad
if test -s member.bad
then
mailx -s 'errors in sqlLoad.following records are rejected' client@client.com < member.bad
fi
touch member.bad
rm member.bad
--
-- this is control file used by sqlldr
--
bash-2.03$ cat member.ctl
load data
infile 'member.dat'
replace into table member
fields terminated by ',' trailing nullcols
(
name,
address
)
--
-- a sample datafile used to load
--
bash-2.03$ cat member.dat
Charlie,250yonge
Ben,123King
Ben,123king
Peter,5Brook
Mr.errror,errodatarejectedbecuaseitwouldntfitintocolumn
|
|
|
|
|