Use the aa.pivot() function to pivot data stored in rows into columns. The function takes as input a table of data to be pivoted, and it automatically constructs the output schema based on the arguments passed to the function. NULL values are handled automatically by the function.
Database user who will run the "pivot" function must obtain the EXECUTE right on the function before running it.