pl/sql code for reporting