{"id":430,"date":"2014-05-23T11:04:03","date_gmt":"2014-05-23T09:04:03","guid":{"rendered":"http:\/\/www.rocworks.at\/wordpress\/?p=430"},"modified":"2014-05-23T11:04:23","modified_gmt":"2014-05-23T09:04:23","slug":"oracle-pivot-query-row-to-column","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=430","title":{"rendered":"Oracle Pivot Query (row to column)&#8230;"},"content":{"rendered":"<p><code>SQL> col PARAMETER  format a30<br \/>\nSQL> col \"SESSION\"  format a30<br \/>\nSQL> col DATABASE  format a30<br \/>\nSQL> col INSTANCE  format a30 <\/p>\n<p>SELECT * from<br \/>\n  (SELECT 'SESSION' scope, nsp.* FROM nls_session_parameters nsp<br \/>\n  union<br \/>\n  SELECT 'DATABASE' scope, ndp.* FROM nls_database_parameters ndp<br \/>\n  union<br \/>\n  SELECT 'INSTANCE' scope, nip.* FROM nls_instance_parameters nip<br \/>\n  ) a<br \/>\nPIVOT  (LISTAGG(VALUE) WITHIN GROUP (ORDER BY scope)<br \/>\nFOR scope<br \/>\nIN ('SESSION' as \"SESSION\",'INSTANCE' as INSTANCE,'DATABASE' as DATABASE))<br \/>\n\/ <\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL> col PARAMETER format a30 SQL> col &#8220;SESSION&#8221; format a30 SQL> col DATABASE format a30 SQL> col INSTANCE format a30 SELECT * from (SELECT &#8216;SESSION&#8217; scope, nsp.* FROM nls_session_parameters nsp union SELECT &#8216;DATABASE&#8217; scope, ndp.* FROM nls_database_parameters ndp union SELECT &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=430\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-430","post","type-post","status-publish","format-standard","hentry","category-oracle"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=430"}],"version-history":[{"count":1,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/430\/revisions"}],"predecessor-version":[{"id":431,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/430\/revisions\/431"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}