<bdo id='zQMhq'></bdo><ul id='zQMhq'></ul>
  1. <i id='zQMhq'><tr id='zQMhq'><dt id='zQMhq'><q id='zQMhq'><span id='zQMhq'><b id='zQMhq'><form id='zQMhq'><ins id='zQMhq'></ins><ul id='zQMhq'></ul><sub id='zQMhq'></sub></form><legend id='zQMhq'></legend><bdo id='zQMhq'><pre id='zQMhq'><center id='zQMhq'></center></pre></bdo></b><th id='zQMhq'></th></span></q></dt></tr></i><div id='zQMhq'><tfoot id='zQMhq'></tfoot><dl id='zQMhq'><fieldset id='zQMhq'></fieldset></dl></div>
  2. <small id='zQMhq'></small><noframes id='zQMhq'>

      <legend id='zQMhq'><style id='zQMhq'><dir id='zQMhq'><q id='zQMhq'></q></dir></style></legend>
    1. <tfoot id='zQMhq'></tfoot>

      如果行不存在,则 Oracle 插入

      Oracle insert if row does not exist(如果行不存在,则 Oracle 插入)

      • <legend id='zZTRS'><style id='zZTRS'><dir id='zZTRS'><q id='zZTRS'></q></dir></style></legend>
          <bdo id='zZTRS'></bdo><ul id='zZTRS'></ul>
          • <tfoot id='zZTRS'></tfoot>

                  <tbody id='zZTRS'></tbody>
              1. <small id='zZTRS'></small><noframes id='zZTRS'>

                <i id='zZTRS'><tr id='zZTRS'><dt id='zZTRS'><q id='zZTRS'><span id='zZTRS'><b id='zZTRS'><form id='zZTRS'><ins id='zZTRS'></ins><ul id='zZTRS'></ul><sub id='zZTRS'></sub></form><legend id='zZTRS'></legend><bdo id='zZTRS'><pre id='zZTRS'><center id='zZTRS'></center></pre></bdo></b><th id='zZTRS'></th></span></q></dt></tr></i><div id='zZTRS'><tfoot id='zZTRS'></tfoot><dl id='zZTRS'><fieldset id='zZTRS'></fieldset></dl></div>
                本文介绍了如果行不存在,则 Oracle 插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                insert ignore into table1 
                select 'value1',value2 
                from table2 
                where table2.type = 'ok'
                

                当我运行它时,我收到错误缺少 INTO 关键字".

                When I run this I get the error "missing INTO keyword".

                推荐答案

                当我运行它时,我收到错误缺少 INTO 关键字".

                When I run this I get the error "missing INTO keyword" .

                因为 IGNORE 不是 Oracle 中的关键字.那是 MySQL 语法.

                Because IGNORE is not a keyword in Oracle. That is MySQL syntax.

                您可以做的是使用 MERGE.

                What you can do is use MERGE.

                merge into table1 t1
                    using (select 'value1' as value1 ,value2 
                           from table2 
                           where table2.type = 'ok' ) t2
                    on ( t1.value1 = t2.value1)
                when not matched then
                   insert values (t2.value1, t2.value2)
                /
                

                从 Oracle 10g 开始,我们可以在不处理两个分支的情况下使用合并.在 9i 中,我们不得不使用虚拟" MATCHED 分支.

                From Oracle 10g we can use merge without handling both branches. In 9i we had to use a "dummy" MATCHED branch.

                在更古老的版本中,唯一的选择是:

                In more ancient versions the only options were either :

                1. 在发出 INSERT 之前(或在子查询中)测试该行是否存在;
                2. 使用 PL/SQL 执行 INSERT 并处理任何由此产生的 DUP_VAL_ON_INDEX 错误.

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

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

                相关文档推荐

                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='mNaU6'></bdo><ul id='mNaU6'></ul>
                    • <i id='mNaU6'><tr id='mNaU6'><dt id='mNaU6'><q id='mNaU6'><span id='mNaU6'><b id='mNaU6'><form id='mNaU6'><ins id='mNaU6'></ins><ul id='mNaU6'></ul><sub id='mNaU6'></sub></form><legend id='mNaU6'></legend><bdo id='mNaU6'><pre id='mNaU6'><center id='mNaU6'></center></pre></bdo></b><th id='mNaU6'></th></span></q></dt></tr></i><div id='mNaU6'><tfoot id='mNaU6'></tfoot><dl id='mNaU6'><fieldset id='mNaU6'></fieldset></dl></div>

                          <tbody id='mNaU6'></tbody>

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

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

                          <tfoot id='mNaU6'></tfoot>