You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By showing the mode of parameters, you help the reader. If you do not specify a parameter mode, the default mode is `IN`. Explicitly showing the mode indication of all parameters is a more assertive action than simply taking the default mode. Anyone reviewing the code later will be more confident that you intended the parameter mode to be `IN`, `OUT` or `IN OUT`.
Copy file name to clipboardExpand all lines: docs/4-language-usage/7-stored-objects/1-general/g-7170.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,18 @@
1
-
# G-7240: Avoid using an IN OUT parameter as IN or OUT only.
1
+
# G-7170: Avoid using an IN OUT parameter as IN or OUT only.
2
2
3
3
!!! warning "Major"
4
4
Efficiency, Maintainability
5
5
6
+
!!! missing "Unsupported in PL/SQL Cop Validators"
7
+
Rule G-7170 is not expected to be implemented in the static code analysis validators.
8
+
6
9
## Reason
7
10
8
-
By showing the mode of parameters, you help the reader. If you do not specify a parameter mode, the default mode is `IN`. Explicitly showing the mode indication of all parameters is a more assertive action than simply taking the default mode. Anyone reviewing the code later will be more confident that you intended the parameter mode to be`IN`/`OUT`.
11
+
Avoid using parameter mode `IN OUT` unless you actually use the parameter both as input and output. If the code body only reads from the parameter, use `IN`; if the code body only assigns to the parameter, use `OUT`. If at the beginning of a project you expect a parameter to be both input and output and therefore choose `IN OUT` just in case, but later development shows the parameter actually is only`IN`or`OUT`, you should change the parameter mode accordingly.
9
12
10
13
## Example (bad)
11
14
12
15
```
13
-
-- Bad
14
16
CREATE OR REPLACE PACKAGE BODY employee_up IS
15
17
PROCEDURE rcv_emp (io_first_name IN OUT employees.first_name%TYPE
16
18
,io_last_name IN OUT employees.last_name%TYPE
@@ -22,7 +24,7 @@ CREATE OR REPLACE PACKAGE BODY employee_up IS
22
24
,io_commission_pct IN OUT employees.commission_pct%TYPE
23
25
,io_manager_id IN OUT employees.manager_id%TYPE
24
26
,io_department_id IN OUT employees.department_id%TYPE
0 commit comments