0

I have an input string "xyz" to function either in upper or lower case.

In this, I have to compare against the string "test|xyz|test1|xyz1". if it found, I have to return 'Y'. Is there any in built function or regular expression available to perform this check in oracle.

1
  • Do you have test|xyz|test1|xyz1 in a table ? Commented Sep 11, 2013 at 11:30

1 Answer 1

1
 Select 'Y' from dual where regexp_like('test|xyz|test1|xyz1','xyz','i');

It will return result only for matched values. If you want 'n' for unmatched values then try regular expression instring.

Or you can do it simply with lower() function on both side and checking for instring.

select case when 
       regexp_instr('test|xyz|test1|xyz1','XYz',1,1,1,'i') > 0 then 'y'
       else 'n' end col1 
from dual
Sign up to request clarification or add additional context in comments.

1 Comment

@user2750658, are u sure this is what you need? this will match xyz with test|test1|xyz1 also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.