PATINDEX_UDF

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Definition

This user-defined function (UDF) returns the starting position of the first occurrence of a pattern in a specified expression or zeros if the pattern is not found.

PATINDEX_UDF(PATTERN VARCHAR, EXPRESSION VARCHAR)

Parameters

PATTERN VARCHAR

The pattern to search for.

EXPRESSION VARCHAR

The expression that is being evaluated.

Returns

Returns an integer with the starting position of the pattern.

Usage example

Input:

SELECT PATINDEX_UDF('an', 'banana');

Output:

2

Last updated