I have a Procedure as you can see below. In this procedure I have a dynamic query
which is qry
variable and I'm using Bind variable
in order to eliminate the risk of injection and improve performance:
create or replace procedure first_test(i_tx varchar2, o_count out number) is
qry varchar2(1000);
begin
qry := 'select count(*) from z_test_a where c_num = :1';
execute immediate qry
into o_count
using i_tx;
dbms_output.put_line(qry);
end;
what I want to know is that , how I can see the exact qry
after using i_tx
. What I mean is that if the input parameter is i_tx = 2
how I can see this select count(*) from z_test_a where c_num = 2
in the output section of the procedure so that I can debug the code in case of error? Is this even possible to see the exact query? In this procedure , what I'm getting right now in the output page is :select count(*) from z_test_a where c_num = :1
.
Thanks in advance
Best Answer
Would
REPLACE
do any good? See line #6 and result ofDBMS_OUTPUT.PUT_LINE
.