G-2610: Never use self-defined weak ref cursor types.
Minor
Changeability, Maintainability, Portability, Reusability
Reason
There is no reason to define your own weak ref cursor types, as they are not different from the built-in sys_refcursor
. Introducing your own types just gives you unnecessary maintenance to perform.
Example (bad)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | declare
type local_weak_cursor_type is ref cursor;
c_data local_weak_cursor_type;
begin
if configuration.use_employee then
open c_data for
select e.employee_id,e.first_name,e.last_name
from employees e;
else
open c_data for
select e.emp_id,e.name
from emp e;
end if;
end;
/
|
Example (good)
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | declare
c_data sys_refcursor;
begin
if configuration.use_employee then
open c_data for
select e.employee_id,e.first_name,e.last_name
from employees e;
else
open c_data for
select e.emp_id,e.name
from emp e;
end if;
end;
/
|