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!

Matching content of two columns

Oracle ManiacOct 5 2018 — edited Oct 8 2018

HI Team

I have two tables in oracle database, details mentioned below:

Tabl1 - Col1, Col2, Col3 ( all are varchar2(4000).

Tabl2 - Col1, Col2, Col3 ( all are varchar2(4000).

The content of Tab1.col2 is a comma separated string. say for e.g.  A,B,C,D.

Similarly, The content of Tab2.col3 is a comma separated string. say for e.g.  D,B,A,C.

My requirement is-

To loop through each and every record of Tab1 and find a matching value in Tab2. col3.

The order of the occurrences of text is immaterial. Say for e.g.  E,F,G will be considered a match with F, G, E.

However E,F,G will not be considered a match for F,E,G,K  (.i.e. any extra text if present in the target table, will not be considered as match)

Appreciate a code snippet in this regard,

Thanks

This post has been answered by Etbin on Oct 5 2018
Jump to Answer
Comments
Post Details
Added on Oct 5 2018
29 comments
8,523 views