• <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 从查询创建序列

        时间:2023-11-02
        <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 从查询创建序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用批量收集时为 LIMIT 设置值 下一篇:PL/SQL 中有散列函数吗?

                  相关文章

                1. <tfoot id='sIw1a'></tfoot>

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

                2. <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'>