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!

Take Value from the string if no comma and value before comma if there is comma

user11164339Jan 19 2015 — edited Mar 3 2015

Hi,

I have two tables,which i have to make a join.Table 1 will have the values with out separated by commas & table 2 will have values may be with comma separated values or just individual values.SO i need a way to join the two tables.

Table 1:

Data

123

234

456

789

Table 2:

Data

123

234,456,8481,6498164

456

789,123,6534363

If i join table1.data(+)=table2.data then i am getting two rows.when i table1.data(+)=SUBSTR(table2.data, 1, instr(table2.data, ',')-1 ) then i am getting two rows which are separated by commas.I need to join two tables if there is no comma then match with that value if the table2 values are separated by commas then took the first value before comma and join.

Can anyone please help me on this.

Thanks,

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2015
Added on Jan 19 2015
20 comments
5,298 views