Expressions and Operator Precedence
ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated
PL/SQL assigns with := , concatenates with || , and evaluates operators in a fixed precedence you can override with parentheses.
How it works
Assignment is := (the SQL = is equality only). String concatenation is ||. Precedence, highest first: ** (exponentiation) and unary +/-, then * and /, then binary + - ||, then comparison operators, then NOT, then AND, then OR. NULL propagates through arithmetic (1 + NULL is NULL). When in doubt, parenthesise — especially mixed AND/OR conditions.
How it works
DECLARE v_a NUMBER := 2; v_b NUMBER := 3; v_c NUMBER := 4; BEGIN DBMS_OUTPUT.PUT_LINE(v_a + v_b * v_c); -- 14, not 20 DBMS_OUTPUT.PUT_LINE((v_a + v_b) * v_c); -- 20 DBMS_OUTPUT.PUT_LINE(2 ** 3 ** 2); -- 512 (right-associative) END; /
Related questions
GroundingGenerated
Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.