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

      <tfoot id='rH9NA'></tfoot>

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

        插入后获取自动生成的 ID

        时间:2023-10-30

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

                <tfoot id='xb6q3'></tfoot>

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

                1. 本文介绍了插入后获取自动生成的 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have an Oracle Express 10g database. In my table I have an auto-generated ID and I would like to know how I can find what the generated ID is after an insert happens. I am currently using PHP.

                  解决方案

                  You can get the returning id into a variable. For example, this code:

                  $data = array("larry","bill","steve");
                  $db = OCILogon("scott","tiger");
                  $stmt = OCIParse($db,"insert into names values (myid.nextval,:name) returning id into :id");
                  
                  OCIBindByName($stmt,":ID",$id,32);
                  OCIBindByName($stmt,":NAME",$name,32);
                  
                  while (list(,$name) = each($data))
                  {
                       OCIExecute($stmt);
                       echo "$name got id:$id
                  "; 
                  }
                  

                  This gives you the ID got by $name in form of the variable $id. Change your SQL accordingly.

                  这篇关于插入后获取自动生成的 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用php,如何插入文本而不覆盖文本文件的开头 下一篇:插入期间的撇号(Mysql)

                  相关文章

                  <tfoot id='2ata1'></tfoot>

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

                    1. <legend id='2ata1'><style id='2ata1'><dir id='2ata1'><q id='2ata1'></q></dir></style></legend>

                      <small id='2ata1'></small><noframes id='2ata1'>

                      • <bdo id='2ata1'></bdo><ul id='2ata1'></ul>