Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns the position of one string within another.
LOCATE( string-expression-1, string-expression-2 [, integer-expression ] )
string-expression-1 The string to be searched.
string-expression-2 The string to be searched for.
integer-expression The character position in the string to begin the search. The first character is position 1. If the starting offset is negative, the locate function returns the last matching string offset rather than the first. A negative offset indicates how much of the end of the string is to be excluded from the search. The number of bytes excluded is calculated as (-1 * offset) -1.
If integer-expression is specified, the search starts at that offset into the string.
The first string can be a long string (longer than 255 bytes), but the second is limited to 255 bytes. If a long string is given as the second argument, the function returns a NULL value. If the string is not found, 0 is returned. Searching for a zero-length string will return 1. If any of the arguments are NULL, the result is NULL.
If multibyte characters are used, with the appropriate collation, then the starting position and the return value may be different from the byte positions.
SQL/2003 Vendor extension.
The following statement returns the value 8.
SELECT LOCATE( 'office party this week - rsvp as soon as possible', 'party', 2 );
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|