oracle 将文本文件中的数据加载到oracle中的表中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3750538/
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
Loading data from a text file to a table in oracle
提问by Aby
I have got 2 questions.
我有两个问题。
- Is there any way to load data to a table in Oracle from a
.txt
file other than using SQL loader? - How to unload data from the table to a text file?
.txt
除了使用 SQL 加载器之外,还有什么方法可以将数据从文件加载到 Oracle 中的表中?- 如何将表中的数据卸载到文本文件?
Someone please help me.
有人请帮助我。
Thanks in advance.
提前致谢。
回答by Jon Heller
There are a bunch of options. It depends on the context - your Oracle version, data format, is this on the client or the server, etc. Here's a quick list, there are probably many other methods:
有很多选择。这取决于上下文 - 您的 Oracle 版本、数据格式、这是在客户端还是服务器上等等。这是一个快速列表,可能还有许多其他方法:
File Input:
文件输入:
- UTL_FILE
- SQL*Loader
- DBMS_XSLPROCESSOR.READ2CLOB
- External Tables
- xmltype.createXMLwith BFILE
- Oracle SQL Developeror other third-party tool
- UTL_FILE
- SQL*加载器
- DBMS_XSLPROCESSOR.READ2CLOB
- 外部表
- 带有 BFILE 的xmltype.createXML
- Oracle SQL Developer或其他第三方工具
File Output:
文件输出:
- UTL_FILE
- Data Dump Utility(wrapper around UTL_FILE)
- DBMS_XSLPROCESSOR.CLOB2FILE
- External Tables
- SQL*Plus script
- Oracle SQL Developeror other third-party tool
- UTL_FILE
- 数据转储实用程序(UTL_FILE 的包装器)
- DBMS_XSLPROCESSOR.CLOB2FILE
- 外部表
- SQL*Plus 脚本
- Oracle SQL Developer或其他第三方工具
回答by Pravin Satav
- Load data from txt file other than sql loader - External table,UTL_FILE package
- Unload data - UTL_FILE package
- 从 sql 加载器以外的 txt 文件加载数据 - 外部表,UTL_FILE 包
- 卸载数据 - UTL_FILE 包
Use google with these key words you will find lot of information.
用这些关键词用google,你会发现很多信息。
回答by Henry Gao
Oracle has a free tool SQL Developer (http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html) you can use to do these.
Oracle 有一个免费工具 SQL Developer ( http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html),您可以使用它来执行这些操作。
回答by Vishnu Gupta
For unloading the data you can just spool the file. In SQLPLUS create a spool file and then run a select query that reads from a table, format the data and return a string. The data will be written to the file.
要卸载数据,您只需假脱机文件即可。在 SQLPLUS 中创建一个假脱机文件,然后运行从表中读取的选择查询,格式化数据并返回一个字符串。数据将写入文件。
Other solutions have already been mentioned. The tools including TOAD have features to create files.
已经提到了其他解决方案。包括 TOAD 在内的工具具有创建文件的功能。
回答by zappee
This is an old topic but I think the following info can help a lot:
这是一个古老的话题,但我认为以下信息可以提供很大帮助:
|-----------------|----------------|----------------|
| LOAD METHOD | DATA ON CLIENT | DATA ON SERVER |
|-----------------|----------------|----------------|
| SQL*Plus | Yes | No |
| SQL*Loader | Yes | No |
| External Tables | No | Yes |
| BFILES | No | Yes |
|-----------------|----------------|----------------|
Source: https://blogs.oracle.com/searchtech/loading-documents-and-other-file-data-into-the-oracle-database
来源:https: //blogs.oracle.com/searchtech/loading-documents-and-other-file-data-into-the-oracle-database
回答by John Townsend
Haven't used it for a few years but PL/SQL Developer has a text importer tool. I'm fairly sure that I have it documented somewhere but you need PL/SQL Developer as a starting point. If you Google "sql developer text importer" you'll get all the info you need.
几年没用了,但 PL/SQL Developer 有一个文本导入器工具。我很确定我在某处记录了它,但是您需要 PL/SQL Developer 作为起点。如果你谷歌“sql developer text importer”,你会得到你需要的所有信息。
回答by Jorge T
Curreent Solution: Load data with SQL* Loader (2016 using Windows 10 and Oracle client 12c)
当前解决方案:使用 SQL* Loader 加载数据(2016 年使用 Windows 10 和 Oracle 客户端 12c)