• <small id='DGU1F'></small><noframes id='DGU1F'>

    <legend id='DGU1F'><style id='DGU1F'><dir id='DGU1F'><q id='DGU1F'></q></dir></style></legend>
    • <bdo id='DGU1F'></bdo><ul id='DGU1F'></ul>

        <i id='DGU1F'><tr id='DGU1F'><dt id='DGU1F'><q id='DGU1F'><span id='DGU1F'><b id='DGU1F'><form id='DGU1F'><ins id='DGU1F'></ins><ul id='DGU1F'></ul><sub id='DGU1F'></sub></form><legend id='DGU1F'></legend><bdo id='DGU1F'><pre id='DGU1F'><center id='DGU1F'></center></pre></bdo></b><th id='DGU1F'></th></span></q></dt></tr></i><div id='DGU1F'><tfoot id='DGU1F'></tfoot><dl id='DGU1F'><fieldset id='DGU1F'></fieldset></dl></div>
      1. <tfoot id='DGU1F'></tfoot>
      2. 用SQL高效插入大量数据

        Insert large amount of data efficiently with SQL(用SQL高效插入大量数据)
        <i id='Ls9x3'><tr id='Ls9x3'><dt id='Ls9x3'><q id='Ls9x3'><span id='Ls9x3'><b id='Ls9x3'><form id='Ls9x3'><ins id='Ls9x3'></ins><ul id='Ls9x3'></ul><sub id='Ls9x3'></sub></form><legend id='Ls9x3'></legend><bdo id='Ls9x3'><pre id='Ls9x3'><center id='Ls9x3'></center></pre></bdo></b><th id='Ls9x3'></th></span></q></dt></tr></i><div id='Ls9x3'><tfoot id='Ls9x3'></tfoot><dl id='Ls9x3'><fieldset id='Ls9x3'></fieldset></dl></div>

        • <tfoot id='Ls9x3'></tfoot><legend id='Ls9x3'><style id='Ls9x3'><dir id='Ls9x3'><q id='Ls9x3'></q></dir></style></legend>

              <bdo id='Ls9x3'></bdo><ul id='Ls9x3'></ul>

                  <tbody id='Ls9x3'></tbody>
              • <small id='Ls9x3'></small><noframes id='Ls9x3'>

                1. 本文介绍了用SQL高效插入大量数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  您好,我经常需要向表中插入大量数据.例如,我会以

                  Hi I often have to insert a lot of data into a table. For example, I would have data from excel or text file in the form of

                  1,a
                  3,bsdf
                  4,sdkfj
                  5,something
                  129,else
                  

                  然后我在这个例子中经常构造6条insert语句并运行SQL脚本.我发现当我必须向服务器发送数千个小包时,这很慢,而且还会给网络带来额外的开销.

                  then I often construct 6 insert statements in this example and run the SQL script. I found this was slow when I have to send thousands of small packages to server, it also causes extra overhead to the network.

                  你最好的方法是什么?

                  更新:我使用的是 ORACLE 10g.

                  Update: I'm using ORACLE 10g.

                  推荐答案

                  使用 Oracle 外部表.

                  另见例如

                  • OraFaq 关于外部表
                  • Tom 对外部表的看法
                  • René Nyffenegger 关于外部表的说明

                  一个可以帮助您入门的简单示例

                  您需要一个位于服务器目录中的文件(熟悉目录对象):

                  You need a file located in a server directory (get familiar with directory objects):

                  SQL> select directory_path from all_directories where directory_name = 'JTEST';
                  
                  DIRECTORY_PATH
                  --------------------------------------------------------------------------------
                  c:datajtest
                  
                  SQL> !cat ~/.gvfs/jtest on 192.168.xxx.xxx/exttable-1.csv
                  1,a
                  3,bsdf
                  4,sdkfj
                  5,something
                  129,else
                  

                  创建外部表:

                  create table so13t (
                    id number(4),
                    data varchar2(20)
                  )
                  organization external (
                    type oracle_loader
                    default directory jtest /* jtest is an existing directory object */
                    access parameters (
                      records delimited by newline
                      fields terminated by ','
                      missing field values are null
                    )
                    location ('exttable-1.csv') /* the file located in jtest directory */
                  )
                  reject limit unlimited;
                  

                  现在您可以使用SQL 的所有功能来访问数据:

                  Now you can use all the powers of SQL to access the data:

                  SQL> select * from so13t order by data;
                  
                          ID DATA
                  ---------- ------------------------------------------------------------
                           1 a
                           3 bsdf
                         129 else
                           4 sdkfj
                           5 something
                  

                  这篇关于用SQL高效插入大量数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How do I split flat file data and load into parent-child tables in database?(如何拆分平面文件数据并加载到数据库中的父子表中?)
                  How to import CSV into sqlite using RSqlite?(如何使用 RSqlite 将 CSV 导入 sqlite?)
                  Import CSV to Update rows in table(导入 CSV 以更新表中的行)
                  Importing MaxMind#39;s GeoLite2 to MySQL(将 MaxMind 的 GeoLite2 导入 MySQL)
                  Import / Export database with SQL Server Server Management Studio(使用 SQL Server Server Management Studio 导入/导出数据库)
                  How do you import a large MS SQL .sql file?(如何导入大型 MS SQL .sql 文件?)
                2. <i id='QShUB'><tr id='QShUB'><dt id='QShUB'><q id='QShUB'><span id='QShUB'><b id='QShUB'><form id='QShUB'><ins id='QShUB'></ins><ul id='QShUB'></ul><sub id='QShUB'></sub></form><legend id='QShUB'></legend><bdo id='QShUB'><pre id='QShUB'><center id='QShUB'></center></pre></bdo></b><th id='QShUB'></th></span></q></dt></tr></i><div id='QShUB'><tfoot id='QShUB'></tfoot><dl id='QShUB'><fieldset id='QShUB'></fieldset></dl></div>
                  <legend id='QShUB'><style id='QShUB'><dir id='QShUB'><q id='QShUB'></q></dir></style></legend>
                      <tbody id='QShUB'></tbody>

                        <tfoot id='QShUB'></tfoot>
                          <bdo id='QShUB'></bdo><ul id='QShUB'></ul>

                          <small id='QShUB'></small><noframes id='QShUB'>