0

In the Oracle PL/SQL, how to debug a complex stored proc ?

for example, the codes below, it is using loop + correlated subquery. how to fully understand it ? I have learned that the best way to debug is divide-and-conquer, then how to cut this coding into small pieces ?

Thanks

v_count := 1;

while v_count > 0
LOOP

update tbl_A a
set a.name = (select b.name from tbl_B b where a.id = b.id)
where a.id = (
    select c.id from tbl_C c where c.id = a.id
)

v_count := sql%rowcount;
END LOOP
4

2 回答 2

1

你没有说你正在使用什么工具,但如果你获得了 Oracle SQL Developer,它包括一个调试器,允许你逐行执行代码、设置断点等等——所有典型的调试功能图形用户界面。

而且,它是免费的。在这里得到它

于 2012-07-02T15:38:59.660 回答
0

尝试注释掉部分代码,然后将到目前为止的结果存储在一个变量中。然后你可以像这样选择它:SELECT @varname至少 MYSQL 5.x 是这样处理它的。

于 2012-07-02T13:56:12.097 回答