DB2- LOCATE Scalar Function

Srinimf-USA-Jobs

LOCATE SCALAR – Function returns first occurrence position in first string, second string:

Example 1:

SELECT LOCATE(‘I’,’MINE STRING’) FROM SYSIBM.SYDUMMY1

It returns value 2. Since first occurrence is 2.

Example 2:

SELECT LOCATE(‘I’,’MINE STRING’,3) FROM SYSIBM.SYDUMMY1

Now the answer will be 9. Since after third position it starts searching for ‘I’.

Read my post on DB2 functions.

Reference link here.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.