zoukankan      html  css  js  c++  java
  • debugging Problem

         参考网址:

              http://forums.allroundautomations.com/ubb/ubbthreads.php?ubb=showflat&Number=14648&PHPSESSID=2e3c1b028a66500ae8a1730abc88b993

        在开发项目的过程中,遇到一个比较比较奇怪的问题,当在过程中声明一个varchar2的变量,将将它的长度设置为32767,在进行DEBUG调试的过程中,当他的长度大于1000的,在下方的变量位置查看不到他的信息,当小于1000的时候,他还是varchar2,比较奇怪。

    例如:

     1 CREATE OR REPLACE PROCEDURE Tt AS
     2   a     VARCHAR2(32767);
     3   v_Out VARCHAR2(32767);
     4   TYPE Gencurtyp IS REF CURSOR;
     5   Generic_Cv Gencurtyp;
     6 BEGIN
     7 
     8   FOR i IN 1 .. 999 LOOP
     9     a := a || 't';
    10   END LOOP;
    11 
    12   Dbms_Output.Put_Line(Length(a));
    13 
    14   FOR i IN 1000 .. 4001 LOOP
    15     a := a || 't';
    16   END LOOP;
    17   Dbms_Output.Put_Line(Length(a));
    18 
    19   -- FOR i IN 1001 .. 32766 LOOP
    20   --   a := a || 't';
    21   -- END LOOP;
    22   Dbms_Output.Put_Line(Length(a));
    23   INSERT INTO t_Ss1 VALUES (a);
    24   --INSERT INTO t_ss VALUES(a);
    25   --INSERT INTO t_sS2 VALUES(a);
    26 
    27   COMMIT;

    其中T_SS,T_SS1,T_SS2三个表的都只有一个字段分别为varchar2(4000),blob,clob.

    测试的过程中,出现了上述的问题。

    ----------------------------------------

    官网上面有个类似的问题:

    During debugging my PL/SQL package, when I want to see the content of VARCHAR2 variable containing text longer than 999 characters, I see the text "Long value" instead. Is there any way how to see the right content of such variables? The version of my PL/SQL developer is 5.1.4.730.

    官网给的解释如上:

    网友提供的解决方法:

    1、建立临时表

    It seems obvious, but just in case you are too focused on the debugger to see it and really mean "any" way...Just temporarily modify the code to dump the value into a temporary table with a long column for the text and creation date. Then commit it immediately after the insert.

    Put a break point after the commit in the debugger. Open a SQL window and select the text sorted by the creation date for multiple iterations and there it is. 

    2、the best resolution I found is splitting up the variable only for debugging
    v_test1 := substr(v_statement, 1 , 950);
    v_test2 := substr(v_statement, 951, 950);
    v_test3 := substr(v_statement,1990, 950);
    I'm not satisfied with this, but I don't know a better one
    中国网友的建议:

    varchar2在过程中定义的时候可以超过4000(最大32767),但是作为存储或参数传入传出时,只能小于4000,你在过程中动态SQL语句可以定义长度不大于32767;调试时有个麻烦:一旦sql语句有问题,你的debug信息就是long   value,不过,你可以这样解决:建一个临时表做测试用(Create   table   tmpDebug(strSQL   Blob);),然后在你的过程中excute之前,把你的strSQL   插入到这个表中,然后,你该知道怎么做了吧.

    在这个过程中得到一个结论:

    当表的列为CLOB,BLOB,VARCHAR2(4000).都可以使用insert插入数据

     

  • 相关阅读:
    JavaWeb学习笔记——开发动态WEB资源(七)bookapp
    JavaWeb学习笔记——开发动态WEB资源(六)ServletConfig和ServletContext
    Eclipse学习笔记——快捷键
    JavaWeb学习笔记——开发动态WEB资源(五)servlet身份验证
    JavaWeb学习笔记——开发动态WEB资源(四)打印当前使用的是get方法
    JavaWeb学习笔记——开发动态WEB资源(三)显示当前时间
    JavaWeb学习笔记——开发动态WEB资源(二)HelloWord
    JavaWeb学习笔记——开发动态WEB资源(一)Java程序向浏览器输出数据
    JavaWeb学习笔记——Tomcat相关
    JavaWeb学习笔记——访问静态HTML网页
  • 原文地址:https://www.cnblogs.com/caroline/p/2509264.html
Copyright © 2011-2022 走看看