For AI agents: an index of this documentation is at https://developer.rippling.com/llms.txt. Public pages have a Markdown version at the same URL with .md added.

Skip to main content
index

DECODE() Function

Use with AI:Rippling AI ChatGPT Claude Cursor

Description​

Compares an expression to search values and returns the matching result.

Syntax​

DECODE(expression, search_result_pairs)

Parameters​

ParameterDescriptionData TypeRequired
expressionColumn or expression to evaluateAnyYes
search_result_pairsVariadic search/result pairs plus optional default.AnyYes

Rewrite​

Semantically equivalent to CASE WHEN expression = search THEN result ... ELSE default END.

Notes​

  • DECODE(...) is accepted in Transformations SQL; the parser normalizes it to an equivalent CASE expression during conversion.

Example​

SELECT
DECODE(e.department, 'Eng', 1, 'Sales', 2, 0)
FROM
rippling.employee.Employee e;