Return the input unchanged (unary plus as a function form).
POSITIVE(expr)
## Overview Returns the input unchanged. POSITIVE is the function form of the unary plus operator (+expr). It has no arithmetic effect and exists primarily for symmetry with NEGATIVE and for expression-tree construction in frameworks that emit SQL programmatically. If you are writing SQL by hand, you rarely need POSITIVE. Use it when a canonical function form reads more clearly in a long expression chain than a bare operator. ## Behavior - Accepts any numeric type. - Returns a value identical to the input. - Returns NULL if the argument is NULL. - Does not change sign, type, or value in any way. ## Numeric precision - POSITIVE is exact: no arithmetic is performed. ## Compatibility - Conforms to the SQL standard convention that unary plus and POSITIVE are equivalent. - Matches typical mathematical library implementations.
| Name | Type | Description |
|---|---|---|
expr | Specifies the numeric expression to return. The value is returned unchanged. |
-- Positive of a positive (unchanged)
SELECT POSITIVE(42);
-- Result: 42
-- Positive of a negative (still negative)
SELECT POSITIVE(-7);
-- Result: -7
-- Positive of zero
SELECT POSITIVE(0);
-- Result: 0
-- Positive of a DOUBLE
SELECT POSITIVE(3.14);
-- Result: 3.14
-- NULL propagation
SELECT POSITIVE(NULL);
-- Result: NULL
-- Column use: document that a signed quantity has already been validated
SELECT txn_id, POSITIVE(signed_amount) AS amount
FROM finance.ledger.transactions
WHERE signed_amount IS NOT NULL;