简体   繁体   English

使用自定义类型调试pl / sql函数

[英]debugging pl/sql function with custom types

I want to use function tq84_select_star_from_table from answer to this question EXECUTE IMMEDIATE in plsql 我想从此问题的答案中使用函数tq84_select_star_from_table,请在plsql中立即执行

I created tq84_varchar2_tab,tq84_varchar2_tab_tab types and when I use function like in the answer to question, it works, but when I try to debug function I get this errors and debugging doesn't start. 我创建了tq84_varchar2_tab,tq84_varchar2_tab_tab类型,当我在问题的答案中使用函数时,它可以工作,但是当我尝试调试函数时,出现此错误,并且调试无法启动。

ORA-06550: Row 13, column 16:

PLS-00382: expression is of wrong type

ORA-06550: Row 13, column  3:

PL/SQL: Statement ignored

When I change type of resultSet and return type of function to VARCHAR2, then debugging starts successfully. 当我更改resultSet的类型并将函数的类型返回到VARCHAR2时,调试将成功开始。 I'm using oracle sql developer. 我正在使用oracle sql开发人员。 I want to know what is wrong. 我想知道哪里出了问题。 在此处输入图片说明

This looks like a bug, or at least an inability to handle custom types as bind variables. 这看起来像一个错误,或者至少不能将自定义类型作为绑定变量来处理。 As a workaround you can change the generated code to skip the assignment to the bind variable: 解决方法是,您可以更改生成的代码以跳过对绑定变量的分配:

Instead of: 代替:

:v_Return := v_Return;

set a dummy value: 设置一个虚拟值:

:v_Return := null;

在此处输入图片说明

You can't just comment the old line out as that gets an 'invalid column index' error, which is something to do with it expecting the bind variable to be set - it doesn't like it you don't refer to :v_Return at all. 您不能只注释掉旧行,因为它会得到“无效的列索引”错误,这与期望设置绑定变量有关—它不喜欢您未引用的内容:v_Return完全没有

And of course you have to have recompiled the function for debugging. 当然,您必须重新编译该功能才能进行调试。 With that done, and the generated debugger code modified, it stops on breakpoints as expected. 完成此操作,并修改生成的调试器代码后,它会按预期在断点处停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM