rspec/rules/S2532/plsql/rule.adoc

54 lines
796 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
By default, the parameter mode is ``++IN++``. However, specifying it explicitly makes the code easier to read.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
SET SERVEROUTPUT ON
DECLARE
PROCEDURE printName(name VARCHAR2) AS -- Noncompliant; relies on default mode
BEGIN
DBMS_OUTPUT.PUT_LINE('name: ' || name);
END;
BEGIN
printName('Foo');
END;
/
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
SET SERVEROUTPUT ON
DECLARE
PROCEDURE printName(name IN VARCHAR2) AS
BEGIN
DBMS_OUTPUT.PUT_LINE('name: ' || name);
END;
BEGIN
printName('Foo');
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Specify this parmeter mode as "IN".
endif::env-github,rspecator-view[]