select * from (select prdt_no, bal from TEST_PIVOT where date_code >='20151121' and date_code<='20151123' ) pivot (sum(bal) as bal for prdt_no in ('1' p1, '2' p2, '3' p3));
select * from (select prdt_no, bal from TEST_PIVOT where date_code >='20151121' and date_code<='20151123' ) pivot (sum(bal) as bal for prdt_no in ('1' p1, '2' p2, '3' p3));