I would use conditional aggregate along with row_number()
:
select code,
max(case when seqnum = 1 then code end) as code_1,
max(case when seqnum = 2 then code end) as code_2,
max(case when seqnum = 3 then code end) as code_3
from (select t.*,
row_number() over (partition by code order by data) as seqnum
from t
) t
group by code;