Roeland
Member³
Hi,
Let me show you the example, that will make it obvious:
1) I have the following package body
2) Apply now the "Extract Procedure" refactoring (I have named it NewProc)
3) The result:
4) What's wrong?
Thanks
Let me show you the example, that will make it obvious:
1) I have the following package body
Code:
create or replace package body Test_Refactoring is
procedure Test (p_Param_1 in pls_integer,
p_OK in Boolean) is
cursor c_Test is
select *
from plsql_profiler_runs t
where t.runid = p_Param_1;
r_Test c_Test%rowtype;
begin
if True then
-- **** Start Refactor
open c_Test;
fetch c_Test into r_Test;
if p_OK and c_Test%found then
Null;
end if;
close c_Test;
-- **** End Refactor
end if;
end ;
end Test_Refactoring;
3) The result:
Code:
create or replace package body Test_Refactoring is
-- Refactored procedure NewProc
procedure NewProc(p_OK in Boolean) is
cursor c_Test is
select *
from plsql_profiler_runs t
where t.runid = p_Param_1;
r_Test c_Test%rowtype;
begin
open c_Test;
fetch c_Test into r_Test;
if p_OK and c_Test%found then
Null;
end if;
close c_Test;
end NewProc;
procedure Test (p_Param_1 in pls_integer,
p_OK in Boolean) is
begin
if True then
-- **** Start Refactor
NewProc(p_OK);
-- **** End Refactor
end if;
end ;
end Test_Refactoring;
- The refactoring fails to detect that it needs also the parameter p_Param_1 (it's being used in the cursor). I know it's not so obvious, but it can be done.
- Could you plz change the parameter passing from positional association to named association. (Make it an option). Example:
NewProc(p_OK => p_OK);
Thanks