Skip to main content

Do not use LIKE conditions without wildcards

ZPA rule for PL/SQL and Oracle SQL · UnnecessaryLike

Using a LIKE condition without a wildcard (% or _) is suspicious. A maintainer can suppose whether a wildcard is forgotten or it is meant as equality test.

Examples​

Noncompliant Code Example
if (last_name like 'Smith') ...
Compliant Solution
if (last_name like 'Smith%') ...

-- or
if (last_name = 'Smith') ...