Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Partial Match and Full Match

Orcl ApexMar 11 2019 — edited Mar 12 2019

Hi

Sample Data -

DROP TABLE t

/

CREATE TABLE t (name VARCHAR2(50))

/

INSERT INTO t VALUES ('an')

/

INSERT INTO t VALUES ('ann')

/

INSERT INTO t VALUES ('annn')

/

SELECT * FROM t WHERE REGEXP_LIKE (name, 'an')

/

Now using an in REGEXP_LIKE return all values an, ann, annn but ann and annn are partial matches.

I want to display result in select statement two more additional columns c1 showing if the result is partial match or not, column c2 showing partial matched string i.e. an, an and an in three rows of c2 column.

desired result -

name          c1          c2

an               Y           an

ann             N           an

annn           N           an

This post has been answered by mathguy on Mar 11 2019
Jump to Answer
Comments
Post Details
Added on Mar 11 2019
7 comments
2,903 views