I have a table data in the following format in Oracle:
Roll_No Paper Code Inst_Code
1 71 10
1 72 10
1 73 10
2 71 10
2 73 10
2 75 10
3 72 11
3 73 11
4 71 11
4 73 11
and so on. I want to display the data in the following format dynamically...
Inst_Code 71 72 73 75
-------- --- --- --- ---
10 2 1 2 1
11 1 1 2 0
select paper_code, inst_code, count(*) from t group by paper_code, inst_codeand pivot bypaper_codevalues ? Pivot columns71,72... cannot be defined dynamically.