Excel File to Oracle data.
Follow these steps
Excel -> CSV -> Oracle
1.Save the Excel spreadsheet as file type 'CSV' (Comma-Separated
Values).
2.Transfer the .csv file to the Oracle server (usually HP Unix).
3.Create the Oracle table, using the SQL CREATE TABLE statement to
define the table's column lengths and types. Here's an example of an
sqlplus 'CREATE
TABLE' statement:
CREATE TABLE T_ACCT
(acct_id VARCHAR2(18),
balance NUMBER(13),
prepay number(13));
4.Use sqlload to load the .csv file into the Oracle table. Create a
sqlload control file like this:
load data
infile T_ACCT.csv
replace
into table T_ACCT
fields terminated by ','
(acct_id,balance,prepay)
5.Invoke sqlload to read the .csv file into the new table, creating one
row in the table for each line in the .csv file. This is done as a Unix
command:
% sqlload userid=username/password control=<filename.ctl>
log=<filename>.log
This will create a log file <filename>.log. Check it for loading
errors.
6.Use these sqlplus commands to check the Oracle table:
DESCRIBE T_ACCT;
SELECT COUNT(*) FROM T_ACCT ;
SELECT * FROM T_ACCT WHERE ROWNUM <5;
7.You're done.
本文提供了一种将Excel数据导入Oracle数据库的方法。首先将Excel文件转换为CSV格式,然后通过SQL命令创建相应的Oracle表,并定义列长度及类型。接着使用SQL*Loader加载CSV文件到Oracle表中,最后检查数据是否正确导入。
3069

被折叠的 条评论
为什么被折叠?



