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

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

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

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

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

        在 Oracle 上使用内部联接更新语句

        时间:2023-07-18
      1. <legend id='Ygw1E'><style id='Ygw1E'><dir id='Ygw1E'><q id='Ygw1E'></q></dir></style></legend>

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

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

                  <tfoot id='Ygw1E'></tfoot>
                    <tbody id='Ygw1E'></tbody>
                  <i id='Ygw1E'><tr id='Ygw1E'><dt id='Ygw1E'><q id='Ygw1E'><span id='Ygw1E'><b id='Ygw1E'><form id='Ygw1E'><ins id='Ygw1E'></ins><ul id='Ygw1E'></ul><sub id='Ygw1E'></sub></form><legend id='Ygw1E'></legend><bdo id='Ygw1E'><pre id='Ygw1E'><center id='Ygw1E'></center></pre></bdo></b><th id='Ygw1E'></th></span></q></dt></tr></i><div id='Ygw1E'><tfoot id='Ygw1E'></tfoot><dl id='Ygw1E'><fieldset id='Ygw1E'></fieldset></dl></div>
                  本文介绍了在 Oracle 上使用内部联接更新语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个在 MySQL 中运行良好的查询,但是当我在 Oracle 上运行它时出现以下错误:

                  I have a query which works fine in MySQL, but when I run it on Oracle I get the following error:

                  SQL 错误:ORA-00933:SQL 命令未正确结束
                  00933. 00000 - SQL 命令未正确结束"

                  SQL Error: ORA-00933: SQL command not properly ended
                  00933. 00000 - "SQL command not properly ended"

                  查询是:

                  UPDATE table1
                  INNER JOIN table2 ON table1.value = table2.DESC
                  SET table1.value = table2.CODE
                  WHERE table1.UPDATETYPE='blah';
                  

                  推荐答案

                  该语法在 Oracle 中无效.你可以这样做:

                  That syntax isn't valid in Oracle. You can do this:

                  UPDATE table1 SET table1.value = (SELECT table2.CODE
                                                    FROM table2 
                                                    WHERE table1.value = table2.DESC)
                  WHERE table1.UPDATETYPE='blah'
                  AND EXISTS (SELECT table2.CODE
                              FROM table2 
                              WHERE table1.value = table2.DESC);
                  

                  或者你可能能够做到这一点:

                  Or you might be able to do this:

                  UPDATE 
                  (SELECT table1.value as OLD, table2.CODE as NEW
                   FROM table1
                   INNER JOIN table2
                   ON table1.value = table2.DESC
                   WHERE table1.UPDATETYPE='blah'
                  ) t
                  SET t.OLD = t.NEW
                  

                  这取决于 Oracle 是否认为内联视图可更新(要更新第二个语句取决于列出的一些规则此处).

                  It depends if the inline view is considered updateable by Oracle ( To be updatable for the second statement depends on some rules listed here ).

                  这篇关于在 Oracle 上使用内部联接更新语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 SQL Server 中计算运行总计 下一篇:订购后如何限制 Oracle 查询返回的行数?

                  相关文章

                    <small id='06mYm'></small><noframes id='06mYm'>

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