यदि आप जानते हैं कि आपके पास तीन कॉलम हैं, तो उन्हें एन्यूमरेट करें और एग्रीगेट करें:
select max(case when seqnum = 1 then type end) as type1,
max(case when seqnum = 1 then date end) as date1,
max(case when seqnum = 1 then amount end) as amount1,
max(case when seqnum = 2 then type end) as type2,
max(case when seqnum = 2 then date end) as date2,
max(case when seqnum = 2 then amount end) as amount2,
max(case when seqnum = 3 then type end) as type3,
max(case when seqnum = 3 then date end) as date3,
max(case when seqnum = 3 then amount end) as amount3
from (select t.*, rownum as seqnum
from t
) t;
यदि आप नहीं जानते कि कितने कॉलम लौटाए जा रहे हैं, तो आपको डायनेमिक SQL (execute immediate
का उपयोग करने की आवश्यकता है। )।