Pls see below the sample data
CREATE TABLE STR_TEST
(
STR VARCHAR2(50 BYTE)
);
commit;
Insert into STR_TEST(STR) Values ('A,B,C');
Insert into STR_TEST(STR) Values ('A,C,B');
Insert into STR_TEST(STR) Values ('D,C,A');
Insert into STR_TEST(STR) Values ('C,A,B');
Insert into STR_TEST(STR) Values ('A,B');
Insert into STR_TEST(STR) Values ('A,B,C,D');
commit;
I have to write a SQL which will compare the input string 'A,B,C' to the column STR in the above table and mark if both strings are same irrespective of the order. So, the input string matched to only the 1st 2 rows in the table:
STR Input_STR Match
----------------------------------
A,B,C A,B,C 1
A,C,B A,B,C 1
C,A,B A,B,C 1
D,C,A A,B,C 0
A,B A,B,C 0
A,B,C,D A,B,C 0
Thank you.