Progress
SQL-92
Guide and Reference


LOCATE Function

Returns the location of the first occurrence of char_expr1 in char_expr2. If the function includes the optional integer argument start_pos, LOCATE begins searching char_expr2 at that position. If the function omits the start_pos argument, LOCATE begins its search at the beginning of char_expr2.

LOCATE denotes the first character position of a character expression as 1. If the search fails, LOCATE returns 0. If either character expression is null, LOCATE returns a null value.

SYNTAX

LOCATE( char_expr1 , char_expr2 , [ start_pos ] ) 

EXAMPLE

The following example uses two string literals as character expressions. LOCATE returns a value of 6:

SELECT LOCATE(’this’, ’test this test’, 1) FROM TEST;
 
LOCATE(THIS,
------------ 
6
1 record selected 

NOTE

COMPATIBILITY

ODBC Compatible


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095