Oracle
 sql >> Database >  >> RDS >> Oracle

Unisciti a colonne di stringhe divise in Oracle

Puoi utilizzare CTE come segue.

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;