SQL Language (MOSC)

MOSC Banner

Regexp_like function Begin with character

edited Mar 17, 2020 5:00AM in SQL Language (MOSC) 4 commentsAnswered ✓

We have requirement to display as 'Y' whenever the product line begin with in the provided list of values. The list of values may changed based requirement. So, we have created custom table to capture these values. But query is not working as expected when comparing multiple values.

With Pstg As

(Select 'comp2' Item, '600241' Product_Line From Dual

  Union All

  Select 'comp2' Item, '2' Product_Line From Dual)

Select Item,

       Product_Line,

       Nvl((Select 'Y' From Dual Where Regexp_Like(Product_Line, '2')), 'N') V3

  From Pstg;

Result:

Here the product line '600241' is not starting with '

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center