{"id":160271,"date":"2024-11-03T21:42:19","date_gmt":"2024-11-03T13:42:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/160271\/"},"modified":"2024-11-03T21:42:20","modified_gmt":"2024-11-03T13:42:20","slug":"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-to_binary_double","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/160271\/","title":{"rendered":"OceanBase \u6559\u7a0b\uff1aOceanBase TO_BINARY_DOUBLE"},"content":{"rendered":"<h1 id=\"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-to_binary_double-muYrCCntPw\">OceanBase \u6559\u7a0b\uff1aOceanBase TO_BINARY_DOUBLE<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u5eab\u6280\u8853\u4e2d\uff0cOceanBase \u4f5c\u70ba\u4e00\u500b\u9ad8\u6027\u80fd\u7684\u5206\u4f48\u5f0f\u6578\u64da\u5eab\u7cfb\u7d71\uff0c\u8d8a\u4f86\u8d8a\u53d7\u5230\u958b\u767c\u8005\u548c\u4f01\u696d\u7684\u9752\u775e\u3002\u5b83\u4e0d\u50c5\u652f\u6301\u9ad8\u4e26\u767c\u7684\u8b80\u5beb\u64cd\u4f5c\uff0c\u9084\u5177\u5099\u826f\u597d\u7684\u64f4\u5c55\u6027\u548c\u5bb9\u932f\u80fd\u529b\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e OceanBase \u4e2d\u7684 TO_BINARY_DOUBLE \u51fd\u6578\uff0c\u5e6b\u52a9\u8b80\u8005\u7406\u89e3\u5176\u7528\u6cd5\u53ca\u61c9\u7528\u5834\u666f\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-to_binary_double%ef%bc%9f-muYrCCntPw\">\u4ec0\u9ebc\u662f TO_BINARY_DOUBLE\uff1f<\/h2>\n<p>TO_BINARY_DOUBLE \u662f OceanBase \u4e2d\u7684\u4e00\u500b\u5167\u5efa\u51fd\u6578\uff0c\u7528\u65bc\u5c07\u5176\u4ed6\u6578\u64da\u985e\u578b\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\uff08DOUBLE\uff09\u3002\u9019\u5728\u8655\u7406\u6578\u64da\u6642\u975e\u5e38\u6709\u7528\uff0c\u7279\u5225\u662f\u5728\u9700\u8981\u9032\u884c\u6578\u5b78\u8a08\u7b97\u6216\u6578\u64da\u5206\u6790\u7684\u60c5\u6cc1\u4e0b\u3002<\/p>\n<h2 id=\"to_binary_double-%e7%9a%84%e8%aa%9e%e6%b3%95-muYrCCntPw\">TO_BINARY_DOUBLE \u7684\u8a9e\u6cd5<\/h2>\n<pre><code>TO_BINARY_DOUBLE(value)<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c<code>value<\/code> \u53ef\u4ee5\u662f\u4efb\u4f55\u6578\u64da\u985e\u578b\uff0c\u5305\u62ec\u6574\u6578\u3001\u5b57\u7b26\u4e32\u6216\u5176\u4ed6\u6578\u5b57\u985e\u578b\u3002\u51fd\u6578\u5c07\u8fd4\u56de\u4e00\u500b\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e7%a4%ba%e4%be%8b-muYrCCntPw\">\u4f7f\u7528\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528 TO_BINARY_DOUBLE \u51fd\u6578\u7684\u793a\u4f8b\uff0c\u5e6b\u52a9\u8b80\u8005\u66f4\u597d\u5730\u7406\u89e3\u5176\u7528\u6cd5\uff1a<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b-1%ef%bc%9a%e5%b0%87%e6%95%b4%e6%95%b8%e8%bd%89%e6%8f%9b%e7%82%ba%e9%9b%99%e7%b2%be%e5%ba%a6%e6%b5%ae%e9%bb%9e%e6%95%b8-muYrCCntPw\">\u793a\u4f8b 1\uff1a\u5c07\u6574\u6578\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578<\/h3>\n<pre><code>SELECT TO_BINARY_DOUBLE(123) AS double_value;<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u8fd4\u56de <code>123.0<\/code>\uff0c\u56e0\u70ba\u6574\u6578 <code>123<\/code> \u88ab\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\u3002<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b-2%ef%bc%9a%e5%b0%87%e5%ad%97%e7%ac%a6%e4%b8%b2%e8%bd%89%e6%8f%9b%e7%82%ba%e9%9b%99%e7%b2%be%e5%ba%a6%e6%b5%ae%e9%bb%9e%e6%95%b8-muYrCCntPw\">\u793a\u4f8b 2\uff1a\u5c07\u5b57\u7b26\u4e32\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578<\/h3>\n<pre><code>SELECT TO_BINARY_DOUBLE('456.78') AS double_value;<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u8fd4\u56de <code>456.78<\/code>\uff0c\u5b57\u7b26\u4e32 <code>'456.78'<\/code> \u88ab\u6210\u529f\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\u3002<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b-3%ef%bc%9a%e8%99%95%e7%90%86-null-%e5%80%bc-muYrCCntPw\">\u793a\u4f8b 3\uff1a\u8655\u7406 NULL \u503c<\/h3>\n<pre><code>SELECT TO_BINARY_DOUBLE(NULL) AS double_value;<\/code><\/pre>\n<p>\u7576\u50b3\u5165 <code>NULL<\/code> \u6642\uff0c\u51fd\u6578\u5c07\u8fd4\u56de <code>NULL<\/code>\uff0c\u9019\u662f\u56e0\u70ba\u7121\u6cd5\u5c07\u7a7a\u503c\u8f49\u63db\u70ba\u6578\u5b57\u3002<\/p>\n<h2 id=\"%e6%87%89%e7%94%a8%e5%a0%b4%e6%99%af-muYrCCntPw\">\u61c9\u7528\u5834\u666f<\/h2>\n<p>TO_BINARY_DOUBLE \u51fd\u6578\u5728\u591a\u7a2e\u5834\u666f\u4e2d\u90fd\u975e\u5e38\u6709\u7528\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u61c9\u7528\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u6e05\u6d17\uff1a<\/strong>\u5728\u6578\u64da\u5206\u6790\u904e\u7a0b\u4e2d\uff0c\u7d93\u5e38\u9700\u8981\u5c07\u4e0d\u540c\u985e\u578b\u7684\u6578\u64da\u7d71\u4e00\u70ba\u6578\u5b57\u683c\u5f0f\uff0c\u4ee5\u4fbf\u9032\u884c\u8a08\u7b97\u548c\u6bd4\u8f03\u3002<\/li>\n<li><strong>\u5831\u8868\u751f\u6210\uff1a<\/strong>\u5728\u751f\u6210\u5831\u8868\u6642\uff0c\u53ef\u80fd\u9700\u8981\u5c07\u5b57\u7b26\u4e32\u683c\u5f0f\u7684\u6578\u64da\u8f49\u63db\u70ba\u6578\u5b57\uff0c\u4ee5\u4fbf\u9032\u884c\u7d71\u8a08\u548c\u8a08\u7b97\u3002<\/li>\n<li><strong>\u6578\u5b78\u8a08\u7b97\uff1a<\/strong>\u5728\u9032\u884c\u8907\u96dc\u7684\u6578\u5b78\u904b\u7b97\u6642\uff0c\u78ba\u4fdd\u6240\u6709\u6578\u64da\u90fd\u662f\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\u683c\u5f0f\uff0c\u53ef\u4ee5\u63d0\u9ad8\u8a08\u7b97\u7684\u6e96\u78ba\u6027\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-muYrCCntPw\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u4f7f\u7528 TO_BINARY_DOUBLE \u51fd\u6578\u6642\uff0c\u958b\u767c\u8005\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>\u78ba\u4fdd\u50b3\u5165\u7684\u5b57\u7b26\u4e32\u80fd\u5920\u6b63\u78ba\u8f49\u63db\u70ba\u6578\u5b57\uff0c\u5426\u5247\u5c07\u6703\u5f15\u767c\u932f\u8aa4\u3002<\/li>\n<li>\u5c0d\u65bc\u975e\u6578\u5b57\u985e\u578b\u7684\u6578\u64da\uff0c\u51fd\u6578\u53ef\u80fd\u7121\u6cd5\u9032\u884c\u8f49\u63db\uff0c\u9700\u63d0\u524d\u9032\u884c\u985e\u578b\u6aa2\u67e5\u3002<\/li>\n<li>\u5728\u8655\u7406\u5927\u91cf\u6578\u64da\u6642\uff0c\u6ce8\u610f\u6027\u80fd\u5f71\u97ff\uff0c\u7279\u5225\u662f\u5728\u5927\u898f\u6a21\u6578\u64da\u8f49\u63db\u6642\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-muYrCCntPw\">\u7e3d\u7d50<\/h2>\n<p>TO_BINARY_DOUBLE \u51fd\u6578\u662f OceanBase \u4e2d\u4e00\u500b\u975e\u5e38\u5be6\u7528\u7684\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u958b\u767c\u8005\u5c07\u4e0d\u540c\u985e\u578b\u7684\u6578\u64da\u8f49\u63db\u70ba\u96d9\u7cbe\u5ea6\u6d6e\u9ede\u6578\uff0c\u5f9e\u800c\u4fbf\u65bc\u9032\u884c\u6578\u5b78\u8a08\u7b97\u548c\u6578\u64da\u5206\u6790\u3002\u7121\u8ad6\u662f\u5728\u6578\u64da\u6e05\u6d17\u3001\u5831\u8868\u751f\u6210\u9084\u662f\u6578\u5b78\u8a08\u7b97\u4e2d\uff0c\u9019\u500b\u51fd\u6578\u90fd\u80fd\u767c\u63ee\u91cd\u8981\u4f5c\u7528\u3002\u5982\u679c\u60a8\u5c0d\u65bc\u6578\u64da\u5eab\u6280\u8853\u6709\u8208\u8da3\uff0c\u4e26\u5e0c\u671b\u5c0b\u627e\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u4f86\u642d\u5efa\u60a8\u7684\u6578\u64da\u5eab\u74b0\u5883\uff0c\u4eab\u53d7\u7a69\u5b9a\u7684\u6027\u80fd\u548c\u9748\u6d3b\u7684\u64f4\u5c55\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to use OceanBase&#8217;s TO_BINARY_DOUBLE function in this comprehensive tutorial, enhancing your data conversion skills effectively.<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-160271","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=160271"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160271\/revisions"}],"predecessor-version":[{"id":160272,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160271\/revisions\/160272"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=160271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=160271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=160271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}