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

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

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

        使用 START WITH 从查询创建序列

        Create a Sequence with START WITH from Query(使用 START WITH 从查询创建序列)
        <i id='7sVz1'><tr id='7sVz1'><dt id='7sVz1'><q id='7sVz1'><span id='7sVz1'><b id='7sVz1'><form id='7sVz1'><ins id='7sVz1'></ins><ul id='7sVz1'></ul><sub id='7sVz1'></sub></form><legend id='7sVz1'></legend><bdo id='7sVz1'><pre id='7sVz1'><center id='7sVz1'></center></pre></bdo></b><th id='7sVz1'></th></span></q></dt></tr></i><div id='7sVz1'><tfoot id='7sVz1'></tfoot><dl id='7sVz1'><fieldset id='7sVz1'></fieldset></dl></div>

          <small id='7sVz1'></small><noframes id='7sVz1'>

            <tbody id='7sVz1'></tbody>
            <bdo id='7sVz1'></bdo><ul id='7sVz1'></ul>
            <legend id='7sVz1'><style id='7sVz1'><dir id='7sVz1'><q id='7sVz1'></q></dir></style></legend>
            <tfoot id='7sVz1'></tfoot>

                  本文介绍了使用 START WITH 从查询创建序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何创建 START WITH 值来自查询的序列?

                  How can I create a Sequence where my START WITH value comes from a query?

                  我正在尝试这种方式:<代码>CREATE SEQUENCE "Seq" INCREMENT BY 1 START WITH (SELECT MAX("ID") FROM "Table");

                  但是,我收到了 ORA-01722 错误

                  But, I get the ORA-01722 error

                  推荐答案

                  START WITH CLAUSE 接受一个整数.您可以动态地形成创建序列"语句,然后使用立即执行来执行它来实现此目的.

                  The START WITH CLAUSE accepts an integer. You can form the "Create sequence " statement dynamically and then execute it using execute immediate to achieve this.

                  declare
                      l_new_seq INTEGER;
                  begin
                     select max(id) + 1
                     into   l_new_seq
                     from   test_table;
                  
                      execute immediate 'Create sequence test_seq_2
                                         start with ' || l_new_seq ||
                                         ' increment by 1';
                  end;
                  /
                  

                  查看这些链接.

                  http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6014.htm
                  http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm

                  这篇关于使用 START WITH 从查询创建序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                  How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                  Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                  Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                  Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                  Reset Sequence in oracle 11g(oracle 11g 中的重置序列)
                1. <tfoot id='sIw1a'></tfoot>

                    <tbody id='sIw1a'></tbody>
                  <legend id='sIw1a'><style id='sIw1a'><dir id='sIw1a'><q id='sIw1a'></q></dir></style></legend>

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

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

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