Skip to main content

Adjacent string literals should be merged

ZPA rule for PL/SQL and Oracle SQL · UnnecessaryStringLiteralConcatenation

Two string literals joined by || on the same line are one constant split for no reason: the reader has to join them to see the text, and a missing space at the junction is easy to overlook.

This rule reports adjacent non-empty string literals joined by || on the same line. A concatenation split across lines to keep long text readable is not reported, nor one with a comment between the literals, one that mixes national (N'...') and database character literals, or one whose merged literal could exceed Oracle's limit for a literal.

Examples​

Noncompliant Code Example
l_text := 'Rack is ' || 'full'; -- Noncompliant
Compliant Solution
l_text := 'Rack is full';