> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions.md).

# Control Flow Functions

{% columns %}
{% column %}
{% content-ref url="/pages/yEKVw6gGGCf8t7SFkuLw" %}
[CASE OPERATOR](/docs/server/reference/sql-functions/control-flow-functions/case-operator.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Implement conditional logic in SQL queries. This operator evaluates conditions and returns a specific value when the first true condition is met.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/OfwsM8Ka9FVINMo9TOA0" %}
[DECODE\_ORACLE](/docs/server/reference/sql-functions/control-flow-functions/decode_oracle.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Compare a value against a list of conditions. This Oracle-compatible function returns a corresponding result when a match is found, or a default value otherwise.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/4TaMXEbk92KoVTO6CvpM" %}
[IF Function](/docs/server/reference/sql-functions/control-flow-functions/if-function.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Complete IF() function reference: IF(expr1,expr2,expr3) conditional syntax, TRUE/NULL evaluation rules, return type context (numeric/string), and examples.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/njoKPHx28eFUg5pkIb4W" %}
[IFNULL](/docs/server/reference/sql-functions/control-flow-functions/ifnull.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Replace NULL values with a fallback. This function returns the first argument if it's not NULL; otherwise, it returns the specified replacement value.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/9pwzZWa6D6dH9t973rfY" %}
[NULLIF](/docs/server/reference/sql-functions/control-flow-functions/nullif.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Compare two expressions and return NULL if they are equal. If the expressions differ, the function returns the first expression.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/kcZjnMIusURN2E7NoauQ" %}
[NVL](/docs/server/reference/sql-functions/control-flow-functions/nvl.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Synonym for IFNULL. This Oracle-compatible function returns the first argument if it is not NULL, or the second argument if the first is NULL.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/GvnpNKHKNB29McMp3zD8" %}
[NVL2](/docs/server/reference/sql-functions/control-flow-functions/nvl2.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Return values based on NULL status. This function returns the second argument if the first is not NULL, and the third argument if the first is NULL.
{% endcolumn %}
{% endcolumns %}
