Thursday, July 22, 2021

OIC - substring a string using index-within-string() function.

Suppose we have a variable which contains a string like "a/b/c/d.txt;name=value" and we need to take the value before the searchstring(;) then that we can achieve following 2 ways:

1. Using substring-before():

substring-before($string,";")

2. Using substring() and index-within-string() functions;

substring($string,1,oraext:index-within-string($string,";")

This function(index-within-string()) returns the zero based index of the first occurance od search string within the input string. The function returns -1 if search string is not found.


No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...