A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/array_position below:

Website Navigation


ARRAY_POSITION | Snowflake Documentation

Categories:

Semi-structured and structured data functions (Array/Object)

ARRAY_POSITION

Returns the index of the first occurrence of an element in an array.

Syntax
ARRAY_POSITION( <variant_expr> , <array> )

Copy

Arguments
value_expr

Value to find in array.

array

The ARRAY to search.

Returns

The function returns an INTEGER specifying the position of value_expr in array.

Usage notes Examples

The examples below show how to use this function:

SELECT ARRAY_POSITION('hello'::variant, array_construct('hello', 'hi'));
+------------------------------------------------------------------+
| ARRAY_POSITION('HELLO'::VARIANT, ARRAY_CONSTRUCT('HELLO', 'HI')) |
|------------------------------------------------------------------|
|                                                                0 |
+------------------------------------------------------------------+

Copy

SELECT ARRAY_POSITION('hi'::variant, array_construct('hello', 'hi'));
+---------------------------------------------------------------+
| ARRAY_POSITION('HI'::VARIANT, ARRAY_CONSTRUCT('HELLO', 'HI')) |
|---------------------------------------------------------------|
|                                                             1 |
+---------------------------------------------------------------+

Copy

SELECT ARRAY_POSITION('hello'::variant, array_construct('hola', 'bonjour'));
+----------------------------------------------------------------------+
| ARRAY_POSITION('HELLO'::VARIANT, ARRAY_CONSTRUCT('HOLA', 'BONJOUR')) |
|----------------------------------------------------------------------|
|                                                                 NULL |
+----------------------------------------------------------------------+

Copy


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4