<i id='pF8lz'><tr id='pF8lz'><dt id='pF8lz'><q id='pF8lz'><span id='pF8lz'><b id='pF8lz'><form id='pF8lz'><ins id='pF8lz'></ins><ul id='pF8lz'></ul><sub id='pF8lz'></sub></form><legend id='pF8lz'></legend><bdo id='pF8lz'><pre id='pF8lz'><center id='pF8lz'></center></pre></bdo></b><th id='pF8lz'></th></span></q></dt></tr></i><div id='pF8lz'><tfoot id='pF8lz'></tfoot><dl id='pF8lz'><fieldset id='pF8lz'></fieldset></dl></div>

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

    <legend id='pF8lz'><style id='pF8lz'><dir id='pF8lz'><q id='pF8lz'></q></dir></style></legend>
      • <bdo id='pF8lz'></bdo><ul id='pF8lz'></ul>
    1. <tfoot id='pF8lz'></tfoot>
    2. 在 Oracle 上使用 ORDER 插入

      INSERT with ORDER on Oracle(在 Oracle 上使用 ORDER 插入)
        <bdo id='bQ8CC'></bdo><ul id='bQ8CC'></ul>

            <tbody id='bQ8CC'></tbody>
          <legend id='bQ8CC'><style id='bQ8CC'><dir id='bQ8CC'><q id='bQ8CC'></q></dir></style></legend>
          <tfoot id='bQ8CC'></tfoot>

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

            <i id='bQ8CC'><tr id='bQ8CC'><dt id='bQ8CC'><q id='bQ8CC'><span id='bQ8CC'><b id='bQ8CC'><form id='bQ8CC'><ins id='bQ8CC'></ins><ul id='bQ8CC'></ul><sub id='bQ8CC'></sub></form><legend id='bQ8CC'></legend><bdo id='bQ8CC'><pre id='bQ8CC'><center id='bQ8CC'></center></pre></bdo></b><th id='bQ8CC'></th></span></q></dt></tr></i><div id='bQ8CC'><tfoot id='bQ8CC'></tfoot><dl id='bQ8CC'><fieldset id='bQ8CC'></fieldset></dl></div>

                本文介绍了在 Oracle 上使用 ORDER 插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 Oracle 10g 上,我们需要将记录从视图插入到表中,以支持本身没有排序或 ORDER 选项的哑客户端应用程序.有什么办法可以控制我们的 INSERT 语句向目标表添加记录的顺序吗?

                On Oracle 10g we need to insert records from a view into a table to support a dumb client application that does not have sort or ORDER options itself. Is there any way to control the order in which our INSERT statement adds records to the destination table?

                推荐答案

                您可以可靠地控制 Oracle 在没有 ORDER BY 的情况下检索表行的顺序.

                You can not reliably control in what order Oracle retrieve the row of a table without an ORDER BY.

                此外,如果没有 /*+APPEND*/ 提示,Oracle 会将行物理地存储在有空间的堆表中,该表可能不在表的末尾!您可能认为 Oracle 按顺序插入它们,但任何 DML 或并发活动(2 个以上会话插入)可能会产生不同的物理组织.

                Furthermore, without the /*+APPEND*/ hint, Oracle will store the rows physically in a heap table where there is room, which may not be at the end of the table ! You may think Oracle inserts them sequentially but any DML or concurrent activity (2+ sessions inserting) might produce a different physical organization.

                您可以使用 INDEX ORGANIZED 表 以PK的顺序存储行.此后对该表的大多数简单查询都将生成一组已排序的行.但是,如果您不指定 ORDER BY,这并不能保证 oracle 会按该顺序选择行(根据查询和访问路径,行可能以任何顺序出现).

                You could use an INDEX ORGANIZED table to store the rows in the order of the PK. Most simple queries thereafter on that table will produce a sorted set of rows. This would not however guarantee that oracle will select the rows in that order if you don't specify an ORDER BY (depending on the query and the access path, the rows may come in any order).

                您也可以使用带有 order by 的视图,如果您无法触摸应用程序,这可能是您最好的选择(重命名表,使用表名创建视图,让应用程序认为它查询了桌子).我不知道你的情况是否可行.

                You could also use a view with an order by, this is probably your best bet if you can't touch the application (rename the table, create a view with the name of the table, let the application think it queries the table). I don't know if it is feasible in your case.

                这篇关于在 Oracle 上使用 ORDER 插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                SQL query to group by day(按天分组的 SQL 查询)
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)

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

                        <tbody id='pKidb'></tbody>

                        <legend id='pKidb'><style id='pKidb'><dir id='pKidb'><q id='pKidb'></q></dir></style></legend>

                        <i id='pKidb'><tr id='pKidb'><dt id='pKidb'><q id='pKidb'><span id='pKidb'><b id='pKidb'><form id='pKidb'><ins id='pKidb'></ins><ul id='pKidb'></ul><sub id='pKidb'></sub></form><legend id='pKidb'></legend><bdo id='pKidb'><pre id='pKidb'><center id='pKidb'></center></pre></bdo></b><th id='pKidb'></th></span></q></dt></tr></i><div id='pKidb'><tfoot id='pKidb'></tfoot><dl id='pKidb'><fieldset id='pKidb'></fieldset></dl></div>
                        <tfoot id='pKidb'></tfoot>

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