Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Returns the position of the first occurrence of substr in str after position pos.
This function is a synonym for position function.
Syntax
locate(substr, str [, pos] )
Arguments
subtr: ASTRINGexpression.str: ASTRINGexpression.pos: An optionalINTEGERexpression.
Returns
An INTEGER.
The specified pos and return value are 1-based.
If pos is omitted substr is searched from the beginning of str.
If pos is less than 1 the result is 0.
Examples
> SELECT locate('bar', 'abcbarbar');
4
> SELECT locate('bar', 'abcbarbar', 5);
7
> SELECT locate('BAR' COLLATE UTF8_BINARY, 'abcbarbar');
0
> SELECT locate('BAR' COLLATE UTF8_LCASE, 'abcbarbar');
4