Skip to main content

Posts

Showing posts from May, 2014

Get Data in Rows and aggregates into columns

The new  PIVOT  operator   in 11g  takes data in separate rows, aggregates it and converts it into columns:- For example we have data in such a format:-  SQL> Select * from (.....) Name Time_Diff Pivot_For A 0 0:0:0.0 First A 0 0:0:2.428 Second A 0 0:0:5.548 Third A 0 0:1:1.991 Fourth B 0 0:2:0.0 First B 0 0:0:3.428 Second B 0 0:0:5.248 Third B 0 0:2:3.991 Fourth C 0 1:2:0.0 First C 0 2:0:3.428 Second C 0 3:0:5.248 Third C 0 0:45:3.991 Fourth To aggregate Data in columns we can use Pivot operator in Oracle as follows:- SQL> Select * from (.....) PIVOT(           Max(Time_Diff)           FOR  Pivot_For in ('First' as First, 'Second' as Second,           'Third' as Third, 'Fourth' as Fourth)         ) N ame First Second Third Fourth A 0 0:0:0.0 0 0:0:

ORA-12520: TNS:listener could not find available handler for requested type of server

Cause:- The most frequent cause is the smaller value of the parameter "PROCESSES" set in Oracle, which needs to be increased in order to solve this issue PROCESSES  specifies the maximum number of operating system user processes that can simultaneously connect to Oracle Value of this parameter can be fetched using query:- SQL> show parameter process SQL>SELECT name, value  FROM gv$parameter  WHERE isdefault = 'FALSE';  Solution:- Login as a system DBA ( conn  sys  as sysdba ) SQL>  alter system set processes=200 scope=spfile Restart the oracle database and the newly entered value for processes parameter will come into effect.