Conditional functions (2)
Last updated Oct 1, 2026 Basin Pipelines scalar function implementations are based on Apache DataFusion ↗︎ (via Arroyo ↗︎) and these docs are derived from the DataFusion function reference.
coalesce
Returns the first of its arguments that is not null. Returns null if all arguments are null. This function is often used to substitute a default value for null values.
coalesce(expression1[, ..., expression_n])
Arguments
- expression1, expression_n: Expression to use if previous expressions are null. Can be a constant, column, or function, and any combination of arithmetic operators. Pass as many expression arguments as necessary.
nullif
Returns null if expression1 equals expression2; otherwise it returns expression1. This can be used to perform the inverse operation of coalesce.
nullif(expression1, expression2)
Arguments
- expression1: Expression to compare and return if equal to expression2. Can be a constant, column, or function, and any combination of arithmetic operators.
- expression2: Expression to compare to expression1. Can be a constant, column, or function, and any combination of arithmetic operators.
nvl
Returns expression2 if expression1 is NULL; otherwise it returns expression1.
nvl(expression1, expression2)
Arguments
- expression1: return if expression1 not is NULL. Can be a constant, column, or function, and any combination of arithmetic operators.
- expression2: return if expression1 is NULL. Can be a constant, column, or function, and any combination of arithmetic operators.
nvl2
Returns expression2 if expression1 is not NULL; otherwise it returns expression3.
nvl2(expression1, expression2, expression3)
Arguments
- expression1: conditional expression. Can be a constant, column, or function, and any combination of arithmetic operators.
- expression2: return if expression1 is not NULL. Can be a constant, column, or function, and any combination of arithmetic operators.
- expression3: return if expression1 is NULL. Can be a constant, column, or function, and any combination of arithmetic operators.
ifnull
Alias of nvl.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/basin-pipelines/sql-reference/scalar-functions/conditional/#page","headline":"Conditional functions","description":"Scalar functions to implement conditional logic","url":"https://developers.cloudflare.com/basin-pipelines/sql-reference/scalar-functions/conditional/","inLanguage":"en","image":"https://developers.cloudflare.com/basin-pipelines/sql-reference/scalar-functions/conditional/og.png?v=53555e8ae1c109ea","dateModified":"2026-10-01","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Scalar functions for hashing values title: Hashing functions image: https://developers.cloudflare.com/basin-pipelines/sql-reference/scalar-functions/hashing/og.png?v=f250318a6f9fc64c
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/basin-pipelines/llms.txt
Use this file to discover all available pages before exploring further.
Docs