How to find cols that are subsets of a given string

How do I find all cols that are a subset of my input string, e.g., ‘abcDEFghi’ would return the following cols:

  • ‘abc’
  • ‘DEF’
  • ‘cDE’
  • ‘Fgh’

But not ‘abcG’ for instance.

POSITION(someCol, ‘abcDEFghi’) <> 0

crmalibu, i like how you covered all your bases by using <>0 instead of >0

you know, just in case POSITION returns a negative number :smiley:

joazito, you are using SQL Server, yes?

Oracle, actually. Any way to do this in Hibernate’s Query Language btw?

never heard of hibernate, but a couple of quick googles and i see it has a LOCATE() function

i couldn’t find a reference manual, so you’re on your own there…

OK, I’ll look into it. Thank you for your assistance both of you.