rspec/rules/S2517/plsql/rule.adoc
2022-02-04 16:28:24 +00:00

58 lines
976 B
Plaintext

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all cursor names match the provided regular expression.
== Noncompliant Code Example
With the default regular expression, ``++[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?++``:
[source,sql]
----
CREATE TABLE employee(
name VARCHAR2(42)
);
DECLARE
CURSOR myCursor_ RETURN employee%ROWTYPE; -- Noncompliant
CURSOR myCursor_ RETURN employee%ROWTYPE IS SELECT * FROM employee; -- Noncompliant
BEGIN
NULL;
END;
/
DROP TABLE employee;
----
== Compliant Solution
[source,sql]
----
CREATE TABLE employee(
name VARCHAR2(42)
);
DECLARE
CURSOR myCursor RETURN employee%ROWTYPE;
CURSOR myCursor RETURN employee%ROWTYPE IS SELECT * FROM employee;
BEGIN
NULL;
END;
/
DROP TABLE employee;
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::parameters.adoc[]
endif::env-github,rspecator-view[]