{"id":725,"date":"2012-04-06T13:18:20","date_gmt":"2012-04-06T11:18:20","guid":{"rendered":"http:\/\/oracle.malin.pl\/?p=725"},"modified":"2012-04-06T13:20:40","modified_gmt":"2012-04-06T11:20:40","slug":"kiedy-select-zwraca-null-a-niedy-no_data_found","status":"publish","type":"post","link":"https:\/\/oracle.malin.pl\/?p=725","title":{"rendered":"Kiedy select zwraca null, a kiedy no_data_found ?"},"content":{"rendered":"<p>Kiedy select zwraca <strong>null<\/strong>, a kiedy <strong>no_data_found<\/strong> jak nic nie znajdzie ?<\/p>\n<p>No w\u0142a\u015bnie, r\u00f3\u017cnie zwraca. Przyk\u0142ady<!--more--><\/p>\n<pre lang=\"plsql\">\r\n-- no_data_found\r\nSelect '1' from dual Where 1=2;\r\n\r\n-- null\r\nSelect sum(1) from dual Where 1=2;\r\nSelect min(1) from dual Where 1=2;\r\nSelect max(1) from dual Where 1=2;\r\n\r\nSelect sum(1), 'A' x from dual Where 1=2;\r\nSelect min(1), 'A' x from dual Where 1=2;\r\nSelect max(1), 'A' x from dual Where 1=2;\r\n\r\n-- no_data_found\r\nSelect sum(1), 'A' x from dual Where 1=2 Group by 2;\r\nSelect min(1), 'A' x from dual Where 1=2 Group by 2;\r\nSelect max(1), 'A' x from dual Where 1=2 Group by 2;\r\n\r\nSelect sum(1) from dual Where 1=2 Having sum(1) is not null;\r\nSelect min(1) from dual Where 1=2 Having sum(1) is not null;\r\nSELECT MAX(1) FROM DUAL WHERE 1=2 HAVING SUM(1) IS NOT NULL;<\/pre>\n<p>&nbsp;<\/p>\n<p>Generalnie, chyba jak jest <strong>funkcja \u00a0agreguj\u0105ca<\/strong>, to zwraca <strong>null<\/strong>.<\/p>\n<p>Ala jak zapytanie ma klauzul\u0119 <strong>group by<\/strong> to zwraca <strong>not_data_found<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kiedy select zwraca null, a kiedy no_data_found jak nic nie znajdzie ? No w\u0142a\u015bnie, r\u00f3\u017cnie zwraca. Przyk\u0142ady<\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[88],"tags":[109],"_links":{"self":[{"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/725"}],"collection":[{"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=725"}],"version-history":[{"count":4,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/725\/revisions"}],"predecessor-version":[{"id":729,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/725\/revisions\/729"}],"wp:attachment":[{"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}