rspec/rules/S1125/plsql/rule.adoc
2023-12-22 10:07:51 +01:00

59 lines
1.0 KiB
Plaintext

:true: TRUE
:false: FALSE
:ops: NOT, AND, OR, =
== Why is this an issue?
include::../description.adoc[]
== How to fix it
include::../how-to-fix-it.adoc[]
=== Code examples
==== Noncompliant code example
[source,sql,diff-id=1,diff-type=noncompliant]
----
SET SERVEROUTPUT ON
DECLARE
foo BOOLEAN := TRUE;
BEGIN
IF foo = FALSE THEN -- Noncompliant
DBMS_OUTPUT.PUT_LINE('foo = false!');
ELSIF foo = TRUE THEN -- Noncompliant
DBMS_OUTPUT.PUT_LINE('foo = true!');
END IF;
END;
/
----
==== Compliant solution
[source,sql,diff-id=1,diff-type=compliant]
----
DECLARE
foo BOOLEAN := TRUE;
BEGIN
IF NOT foo THEN -- Compliant
DBMS_OUTPUT.PUT_LINE('foo = false!');
ELSIF foo THEN -- Compliant
DBMS_OUTPUT.PUT_LINE('foo = true!');
END IF;
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
endif::env-github,rspecator-view[]