• <legend id='6Bawh'><style id='6Bawh'><dir id='6Bawh'><q id='6Bawh'></q></dir></style></legend>
    <tfoot id='6Bawh'></tfoot>

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

      1. Oracle 错误 ORA-06512

        时间:2023-11-28

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

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

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

                • 本文介绍了Oracle 错误 ORA-06512的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  就是不明白为什么它给我 ORA-06512 错误

                  Just can't figure out why it gives me ORA-06512 Error

                  PROCEDURE PX(pNum INT,pIdM INT,pCv VARCHAR2,pSup FLOAT)
                  AS
                      vSOME_EX EXCEPTION;
                  
                  BEGIN 
                      IF ((pNum < 12) OR (pNum > 14)) THEN     
                          RAISE vSOME_EX;
                      ELSE  
                          EXECUTE IMMEDIATE  'INSERT INTO M'||pNum||'GR (CV, SUP, IDM'||pNum||') VALUES('||pCv||', '||pSup||', '||pIdM||')';
                      END IF;
                  END PX;
                  

                  插入的表的结构基础:

                  CREATE TABLE "DB"."M12GR" (
                      "IDM12GR" NUMBER(10,0) NOT NULL ENABLE, 
                      "CV" VARCHAR(5) NOT NULL ENABLE, 
                      "SUP" FLOAT(126) NOT NULL ENABLE, 
                      "IDM12" NUMBER(10,0) NOT NULL ENABLE, 
                  
                      CONSTRAINT "PRIMARY_30" PRIMARY KEY ("IDM12GR"),
                      CONSTRAINT "M12SUELORM12" FOREIGN KEY ("IDM12") REFERENCES "DB"."M12" ("IDM12") ENABLE
                  )
                  

                  推荐答案

                  ORA-06512 是错误堆栈的一部分.它给了我们发生异常的行号,但没有给出异常的原因.这通常在堆栈的其余部分(您尚未发布)中指示.

                  ORA-06512 is part of the error stack. It gives us the line number where the exception occurred, but not the cause of the exception. That is usually indicated in the rest of the stack (which you have still not posted).

                  在你说的评论中

                  "仍然,当 pNum 不在 12 和 14 之间时会出现错误;当 pNum在 12 到 14 之间它不会失败"

                  "still, the error comes when pNum is not between 12 and 14; when pNum is between 12 and 14 it does not fail"

                  好吧,您的代码是这样做的:

                  Well, your code does this:

                  IF ((pNum < 12) OR (pNum > 14)) THEN     
                      RAISE vSOME_EX;
                  

                  也就是说,当 pNum 不在 12 和 14 之间时它会引发异常.那么错误堆栈的其余部分是否包括这一行?

                  That is, it raises an exception when pNum is not between 12 and 14. So does the rest of the error stack include this line?

                  ORA-06510:PL/SQL:未处理的用户定义异常

                  如果是这样,您需要做的就是添加一个异常块来处理错误.也许:

                  If so, all you need to do is add an exception block to handle the error. Perhaps:

                  PROCEDURE PX(pNum INT,pIdM INT,pCv VARCHAR2,pSup FLOAT)
                  AS
                      vSOME_EX EXCEPTION;
                  
                  BEGIN 
                      IF ((pNum < 12) OR (pNum > 14)) THEN     
                          RAISE vSOME_EX;
                      ELSE  
                          EXECUTE IMMEDIATE  'INSERT INTO M'||pNum||'GR (CV, SUP, IDM'||pNum||') VALUES('||pCv||', '||pSup||', '||pIdM||')';
                      END IF;
                  exception
                      when vsome_ex then
                           raise_application_error(-20000
                                                   , 'This is not a valid table:  M'||pNum||'GR');
                  
                  END PX;
                  

                  该文档深入介绍了处理 PL/SQL 异常.

                  The documentation covers handling PL/SQL exceptions in depth.

                  • 了解详情.莉>

                  这篇关于Oracle 错误 ORA-06512的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:选择到Oracle中的临时表 下一篇:PL/SQL 查询 IN 逗号分隔的字符串

                  相关文章

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

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

                    • <bdo id='NTnu9'></bdo><ul id='NTnu9'></ul>

                    <tfoot id='NTnu9'></tfoot>
                    <legend id='NTnu9'><style id='NTnu9'><dir id='NTnu9'><q id='NTnu9'></q></dir></style></legend>