G-2610
🆓Warning
Never use self-defined weak ref cursor types.
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
Non-Compliant Example
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;
/Issues
| Line | Column | Message |
|---|---|---|
| 2 | 4 |
Compliant Solution - ★★★★★
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;
/Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| DisableAllQuickFix | Comma-separated list of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- same as plsql:WeakRefCursorCheck
- same as Trivadis G-2610