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

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

        <tfoot id='HwM1t'></tfoot>
        • <bdo id='HwM1t'></bdo><ul id='HwM1t'></ul>

      1. Oracle:创建一个带有 Auto Increment id 列的视图

        Oracle: Create a View with Auto Increment id column(Oracle:创建一个带有 Auto Increment id 列的视图)

              <small id='1imc8'></small><noframes id='1imc8'>

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

                • <legend id='1imc8'><style id='1imc8'><dir id='1imc8'><q id='1imc8'></q></dir></style></legend>
                    <tbody id='1imc8'></tbody>

                  本文介绍了Oracle:创建一个带有 Auto Increment id 列的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个 view 来填充来自不同表的数据.我使用了 10 个 select 语句,并使用 UNION ALL 组合了这些 select 语句的结果.

                  I have created a view that fills data from different tables. I used 10 select statements and combine the results of those select statements using UNION ALL.

                  我想将 primary key column 添加到我的视图中.因为我必须使用此 view 中的数据创建 XML 文件.所以我需要一个 primary key column 用于我的 XML 构建应用程序中的某些过程.

                  I want to add primary key column to my view. because I have to create XML file using data in this view. so I need a primary key column for some process in my XML building application.

                  我已将 rownum 添加到我所有的选择语句中.但它返回了重复的 ID.因为rownum在每个select语句中都是从1开始的.

                  I have add rownum to all my select statements. But it returned duplicate ids. because rownum in each select statements start from 1.

                  然后我创建了一个序列并尝试使用 nextval .但我不能使用序列,因为我的选择语句有 group byorder by.

                  Then I have created a sequence and tried use nextval . But I can't use sequence because my select statements has group by and order by.

                  有没有办法做到这一点?

                  Is there any way to do that ?

                  推荐答案

                  你可以在联合上做一个选择,例如:

                  You can do a select over the union, for example:

                  SELECT rownum(),*
                  FROM (SELECT * FROM tableA UNION ALL SELECT * FROM tableB)
                  

                  更新

                  SELECT rownum, t.*
                  FROM (SELECT * FROM tableA UNION ALL SELECT * FROM tableB) t
                  

                  这篇关于Oracle:创建一个带有 Auto Increment id 列的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  Creating a flattened table/view of a hierarchically-defined set of data(创建分层定义的数据集的扁平表/视图)
                  MySQL: how to do row-level security (like Oracle#39;s Virtual Private Database)?(MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?)
                  What is the best way to enforce a #39;subset#39; relationship with integrity constraints(强制执行具有完整性约束的“子集关系的最佳方法是什么)
                  Split String by delimiter position using oracle SQL(使用 oracle SQL 按分隔符位置拆分字符串)
                  How to unfold the results of an Oracle query based on the value of a column(如何根据列的值展开Oracle查询的结果)

                  • <bdo id='XVErl'></bdo><ul id='XVErl'></ul>

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

                  • <tfoot id='XVErl'></tfoot>

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

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