debug in pl/sql script or display datas of many tables

Viewed 34

In T-SQL I used to debug in script or stored procedure like below (very simple example), to check the data of the tables :

declare @my_variable nvarchar(4) = 'test';
....

update t
   set t.my_column = case when t.my_column_3 = 1
                          then 1 + 1
                          when t.my_column_4 = 2
                          then 2 + 2
                          ...
                     end
  from my_table t
 where t.column_2 = 'test';

--check the updated data
select t.my_column, t.my_column_2, t.my_column_3, t.my_column_4
  from my_table t
 where t.column_2 = 'test';

update t
   set t.my_column_5 = case when t.my_column_6 + t.my_column_7 = t.my_column_8
                          then 'OK'
                          else 'NOT OK'                                                   
                     end,
       ....
  from my_table t
 where t.column_2 = 'test_2';

--check the updated data
select t.my_column_5, t.my_column_6, t.my_column_7, t.my_column_8
  from my_table t
 where t.column_2 = 'test_2';

etc..

I know that in Oracle is quite different but is there a similar way to check the data of some tables in a middle of a pl/sql script.

I did some research and apparently we can use dbms_output but it's not as simple as a select * from my_table like in T-SQL.

Also sometimes, after running a pl/sql script (manipulate the data etc), I need to display the datas of two or more tables in my script (for controlling purpose) is it possible ?

All suggestions are welcome.

Thank you.

0 Answers
Related