FIRST_VALUE

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > Basic Building Blocks > Functions > Built-in Functions >

FIRST_VALUE

Previous pageReturn to chapter overviewNext page

FIRST_VALUE returns the evaluation of the <value expression> from the first row that qualifies for the aggregate. FIRST_VALUE requires the OVER clause, and is considered an analytic function. FIRST_VALUE has a null treatment option defined below.

Syntax

FIRST_VALUE( <value-expression> ) <null treatment> OVER <window-specification>

 

Null treatment option

Effect

FIRST_VALUE(x) IGNORE NULLS OVER <window-specification>

Returns first non null value of x in <window-specification>

FIRST_VALUE(x) RESPECT NULLS OVER <window-specification>

Returns first value, including null of x in <window-specification>

FIRST_VALUE(x) OVER <window-specification>

Returns first value, including null of x in <window-specification>

See the topic WINDOW clause of the SELECT statement for more details on defining windows.