go to asktom.oracle.com and search for pivot query