Subject Re: [firebird-support] Looking for a stored procedure or function that can find the second occurance of value passed in
Author Mark Rotteveel
On Thu, 14 Mar 2013 10:00:17 -0500, "SoftTech" <miket@...>
wrote:
> Greetings All,
>
> I would like to pass in a string and a substr and the position of where
> the
> x occurrence is.
>
> Example:
> String: Then the big red fox jumped over the flowing stream."
> SubStr: the
> occurrence: 2
>
> Would return 34 which is the starting position of the second "the" found
> in
> the string passed in.
>
> Anything like this available anywhere?

You can use POSITION(...)
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-intfunc-position.html
but you will need to keep track of the number of occurrences yourself.

Mark