{"id":745,"date":"2020-02-19T20:44:53","date_gmt":"2020-02-20T02:44:53","guid":{"rendered":"https:\/\/linux.asberry.org\/blog_tech\/?p=745"},"modified":"2024-05-14T09:13:25","modified_gmt":"2024-05-14T14:13:25","slug":"tcc-ora-01791-not-a-selected-expression","status":"publish","type":"post","link":"https:\/\/asberry.org\/blog_tech\/?p=745","title":{"rendered":"TCC &#8211; ORA-01791: not a SELECTed expression"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Love running into this error. What happens here is that I&#8217;m doing an export and I want it to return distinct rows and I want to sort it by a date, but I&#8217;ve modified the date to format it how I want to see it. For some reason when we preventDuplicates=&#8221;true&#8221; it sees that the date (having been converted) as not a selected expression.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the trick is, on your sorting, you have to use the same custom function toChar to get it to sort by the order you want it to. Kind of a pain but in the end of the equation it makes sense that both the projection and the sort by are the same, too bad you can&#8217;t just use the alias&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Love running into this error. What happens here is that I&#8217;m doing an export and I want it to return distinct rows and I want to sort it by a date, but I&#8217;ve modified the date to format it how I want to see it. For some reason when we preventDuplicates=&#8221;true&#8221; it sees that the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13],"tags":[],"class_list":["post-745","post","type-post","status-publish","format-standard","hentry","category-tcc","author-aron"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4bBkH-c1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=745"}],"version-history":[{"count":1,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions"}],"predecessor-version":[{"id":746,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions\/746"}],"wp:attachment":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}