{"id":37,"date":"2003-04-26T11:49:02","date_gmt":"2003-04-26T01:49:02","guid":{"rendered":"http:\/\/www.thunderguy.com\/plusplus\/20050422\/oracle-empty-string-null\/"},"modified":"2009-06-24T00:01:15","modified_gmt":"2009-06-23T11:01:15","slug":"oracle-empty-string-null","status":"publish","type":"post","link":"https:\/\/thunderguy.com\/semicolon\/2003\/04\/26\/oracle-empty-string-null\/","title":{"rendered":"Oracle empty string = null"},"content":{"rendered":"<p>In Oracle 8, there is no such thing as a zero-length string. Any zero-length string, either from a function call or the literal <code>''<\/code>, is treated as null.<\/p>\n<p>Some of the consequences of this are counterintuitive. Here are some examples.<\/p>\n<ul>\n<li>The expression <code><em>X<\/em>=''<\/code> is never true, regardless of what <code><em>X<\/em><\/code> is. In particular:\n<li>The expression <code>''=''<\/code> is not true.<\/li>\n<li>If you store an empty string (<code>''<\/code>) and read it back, the result will be null.<\/li>\n<li>The expression <code>trim('   ')<\/code> returns null.<\/li>\n<\/ul>\n<p>Be careful of this when writing your queries, particularly if you are porting code between Oracle and another database.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Oracle 8, there is no such thing as a zero-length string. Any zero-length string, either from a function call or the literal &#8221;, is treated as null. Some of the consequences of this are counterintuitive. Here are some examples. The expression X=&#8221; is never true, regardless of what X is. In particular: The expression [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[5],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","tag-sql"],"_links":{"self":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":1,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":163,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/37\/revisions\/163"}],"wp:attachment":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}