Oracle
 sql >> Base de données >  >> RDS >> Oracle

Joindre aux colonnes de chaînes fractionnées dans Oracle

Vous pouvez utiliser CTE comme suit.

with pfcc as 
(select REGEXP_SUBSTR(delimited , '[^\]+', 1, 1) colA,
       REGEXP_SUBSTR(delimited , '[^\]+', 1, 2) colB,
       REGEXP_SUBSTR(delimited , '[^\]+', 1, 3) colC,
       REGEXP_SUBSTR(delimited , '[^\]+', 1, 4) colD
  from products
 where productid = 1)
select * from pfcc tmp
inner join lineitems gch 
    on gch.Line = tmp.colA
    AND gch.productB = tmp.colB
    AND gch.productC = tmp.colC;