By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
5 rows affected
1 rows affected
dbms_output:
CREATE GLOBAL TEMPORARY TABLE tmpPivotTableA
ON COMMIT PRESERVE ROWS AS
SELECT *
FROM (SELECT ID, CCL, Flag FROM TableA) src
PIVOT (MAX(Flag) FOR (CCL) IN ('adam' as "adam", 'john' as "john", 'rob' as "rob", 'terry' as "terry")) pvt
ID | adam | john | rob | terry |
---|---|---|---|---|
1 | x | x | x | null |
2 | null | x | null | null |