database 将 Excel 数据表加载到 Oracle 数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/120001/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 06:58:03  来源:igfitidea点击:

Load Excel data sheet to Oracle database

exceldatabaseoraclenullpointerexceptionmigrate

提问by whiz

I am looking for a free tool to load Excel data sheet into an Oracle database. I tried the Oracle SQL developer, but it keeps throwing a NullPointerException. Any ideas?

我正在寻找一个免费工具来将 Excel 数据表加载到 Oracle 数据库中。我尝试了 Oracle SQL 开发人员,但它不断抛出 NullPointerException。有任何想法吗?

回答by Galwegian

Excel -> CSV -> Oracle

Excel -> CSV -> 甲骨文

Save the Excel spreadsheet as file type 'CSV' (Comma-Separated Values).

将 Excel 电子表格保存为文件类型“CSV”(逗号分隔值)。

Transfer the .csv file to the Oracle server.

将 .csv 文件传输到 Oracle 服务器。

Create the Oracle table, using the SQL CREATE TABLEstatement to define the table's column lengths and types.

创建 Oracle 表,使用 SQLCREATE TABLE语句定义表的列长度和类型。

Use sqlload to load the .csv file into the Oracle table. Create a sqlload control file like this:

使用 sqlload 将 .csv 文件加载到 Oracle 表中。像这样创建一个 sqlload 控制文件:

load data
infile theFile.csv
replace
into table theTable
fields terminated by ','
(x,y,z)

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 将 .csv 文件读入新表,为 .csv 文件中的每一行在表中创建一行。这是作为 Unix 命令完成的:

% sqlload userid=username/password control=<filename.ctl> log=<filename>.log

OR

或者

If you just want a tool, use QuickLoad

如果您只想要一个工具,请使用QuickLoad

回答by jimmyorr

Another way to do Excel -> CSV -> Oracle is using External Tables, first introduced in 9i. External tables let you query a flat file as if it's a table. Behind the scenes Oracle is still using SQL*Loader. There's a solid tutorial here:

执行 Excel -> CSV -> Oracle 的另一种方法是使用外部表,在 9i 中首次引入。外部表让您可以像查询表一样查询平面文件。在幕后,Oracle 仍在使用 SQL*Loader。这里有一个可靠的教程:

http://www.orafaq.com/node/848

http://www.orafaq.com/node/848

回答by Tony Andrews

Oracle Application Express, which comes free with Oracle, includes a "Load Spreadsheet Data" utility under:

Oracle Application Express随 Oracle 免费提供,包括一个“加载电子表格数据”实用程序,位于:

Utilities > Data Load/Unload > Load > Load Spreadsheet Data

You need to save the spreadsheet as a CSV file first.

您需要先将电子表格保存为 CSV 文件。

回答by Tony Andrews

If this is a one time process you may just want to copy and paste the data into a Microsoft access table and do an append query to the oracle table that you have setup through your odbc manager.

如果这是一个一次性过程,您可能只想将数据复制并粘贴到 Microsoft 访问表中,并对通过 odbc 管理器设置的 oracle 表执行附加查询。

回答by smshafiqulislam


There are different ways to load excel/csv to oracle database. I am giving those below:
1. Use Toad. Toad gives very fexible option to upload excel. It gives column mapping window as well. Normally from Tools -> Import, you will find the option. For details I can provide full instruction manual.
2. Load to Microsoft Access first and then pass it to Oracle from there.
Step1: There is a tab in access named "External Data" which gives excel upload to access database.
Step2: Once table is created, just click write mouse on the table and choose Export to ODBC DATABASE. It will ask for oracle database connection details. It's is free.
3. Use Oracle SQL Loader. It's a service which have datafile, control file. You need to write configuration. It is used as text/any file load which maintain one pattern.


有多种方法可以将 excel/csv 加载到 oracle 数据库。我提供以下内容:
1. 使用 Toad。Toad 提供了非常灵活的上传 excel 选项。它也提供了列映射窗口。通常从工具 -> 导入,您会找到该选项。有关详细信息,我可以提供完整的说明手册。
2. 首先加载到 Microsoft Access,然后从那里将其传递给 Oracle。
步骤1:访问中有一个名为“外部数据”的选项卡,可以将excel上传到访问数据库。
步骤 2:创建表后,只需在表上单击写入鼠标并选择导出到 ODBC 数据库。它将询问 oracle 数据库连接的详细信息。它是免费的。
3. 使用 Oracle SQL 加载器。这是一个具有数据文件、控制文件的服务。您需要编写配置。它用作保持一种模式的文本/任何文件加载。

Hope it helps. If required, I can share more details.

希望能帮助到你。如果需要,我可以分享更多细节。

回答by Richard Briggs

As you mention you are looking for a tool - you might like to check out this Oracle specific video - you can load data from any source -

正如您提到的,您正在寻找一种工具 - 您可能想查看此特定于 Oracle 的视频 - 您可以从任何来源加载数据 -

http://youtu.be/shYiN2pnPbA

http://youtu.be/shYiN2pnPbA