{"id":7444,"date":"2021-02-18T23:12:04","date_gmt":"2021-02-19T04:12:04","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=7444"},"modified":"2021-02-18T23:12:04","modified_gmt":"2021-02-19T04:12:04","slug":"oracle-function-keeping-null-records-with-listagg","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=7444","title":{"rendered":"Oracle Function &#8211; Keeping Null Records With LISTAGG"},"content":{"rendered":"<p>I have been using LISTAGG to group a bunch of records together to be presented in a single HTML table cell. Problem is LISTAGG doesn&#8217;t do anything with null field values. As such, the data doesn&#8217;t line up across columns. The three ID values have two string values, which basically get centered in the cell. You cannot tell <em>which<\/em> ID value goes to which name value.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=7445\" rel=\"attachment wp-att-7445\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7445\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListAggWithoutNullRecords.png\" alt=\"\" width=\"482\" height=\"95\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListAggWithoutNullRecords.png 482w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListAggWithoutNullRecords-300x59.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListAggWithoutNullRecords-480x95.png 480w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/a><\/p>\n<p>By adding a concatenation to the LISTAGG value, <em>something<\/em> will be included in the result set even when the record value is null.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=7446\" rel=\"attachment wp-att-7446\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7446\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/listagg-addspaces.png\" alt=\"\" width=\"498\" height=\"138\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/listagg-addspaces.png 498w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/listagg-addspaces-300x83.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/a><\/p>\n<p>Voila &#8212; records line up and I can tell the first ID doesn&#8217;t have an associated string value.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=7447\" rel=\"attachment wp-att-7447\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7447\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListaggWithNullRecords.png\" alt=\"\" width=\"458\" height=\"103\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListaggWithNullRecords.png 458w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/02\/ListaggWithNullRecords-300x67.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been using LISTAGG to group a bunch of records together to be presented in a single HTML table cell. Problem is LISTAGG doesn&#8217;t do anything with null field values. As such, the data doesn&#8217;t line up across columns. The three ID values have two string values, which basically get centered in the cell. &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1004],"tags":[1062,595,1061,1060],"class_list":["post-7444","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-listagg","tag-oracle","tag-oracle-function","tag-oracle-functions"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7444"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7444\/revisions"}],"predecessor-version":[{"id":7448,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7444\/revisions\/7448"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}