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.






