{"id":5329,"date":"2024-11-14T11:08:08","date_gmt":"2024-11-14T03:08:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5329\/"},"modified":"2024-11-14T11:08:08","modified_gmt":"2024-11-14T03:08:08","slug":"oracle%e6%80%8e%e4%b9%88%e5%af%bc%e5%87%bablob","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5329\/","title":{"rendered":"oracle\u600e\u4e48\u5bfc\u51fablob"},"content":{"rendered":"<blockquote><p>\n  oracle \u4e2d\u5bfc\u51fa blob \u6570\u636e\u7684\u6b65\u9aa4\uff1a\u8fde\u63a5\u5230 oracle \u6570\u636e\u5e93\u3002\u521b\u5efa\u5bfc\u51fa\u6587\u4ef6\u3002\u6267\u884c\u5bfc\u51fa\u67e5\u8be2\uff1aselect * from table_name where column_name = &#8216;file_name.ext&#8217; into outfile &#8216;\/path\/to\/file.ext&#8217; using lob (&#8216;column_name&#8217;);\u786e\u8ba4\u5bfc\u51fa\uff1aselect dbms_lob.fileexists(&#8216;\/path\/to\/file.ext&#8217;) from dual;\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/26\/2024052619393818088.jpg\" class=\"aligncenter\" title=\"oracle\u600e\u4e48\u5bfc\u51fablob\u63d2\u56fe\" alt=\"oracle\u600e\u4e48\u5bfc\u51fablob\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Oracle \u4e2d\u5bfc\u51fa BLOB<\/strong><\/p>\n<p>BLOB\uff08\u4e8c\u8fdb\u5236\u5927\u5bf9\u8c61\uff09\u662f\u7528\u4e8e\u5b58\u50a8\u4e8c\u8fdb\u5236\u6570\u636e\u7684 Oracle \u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u9700\u8981\u5c06 BLOB \u6570\u636e\u4ece Oracle \u6570\u636e\u5e93\u4e2d\u63d0\u53d6\u5230\u6587\u4ef6\uff0c\u5219\u9700\u8981\u4f7f\u7528\u5bfc\u51fa\u529f\u80fd\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u8fde\u63a5\u5230 Oracle \u6570\u636e\u5e93\u3002<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 SQL*Plus\u3001SQL Developer \u6216\u5176\u4ed6 Oracle \u5ba2\u6237\u5de5\u5177\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u5bfc\u51fa\u6587\u4ef6\u3002<\/strong><\/p>\n<ul>\n<li>\u5728\u76ee\u6807\u7cfb\u7edf\u4e0a\u521b\u5efa\u6587\u4ef6\u6765\u5b58\u50a8 BLOB \u6570\u636e\u3002\u6587\u4ef6\u6269\u5c55\u540d\u53ef\u4ee5\u4e3a .blob\u3001.bin \u6216\u4efb\u4f55\u5176\u4ed6\u4e0e\u4e8c\u8fdb\u5236\u6570\u636e\u5173\u8054\u7684\u6269\u5c55\u540d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6267\u884c\u5bfc\u51fa\u67e5\u8be2\u3002<\/strong><\/p>\n<ul>\n<li>\n<p>\u6267\u884c\u4ee5\u4e0b\u67e5\u8be2\u4ee5\u5c06 BLOB \u6570\u636e\u5bfc\u51fa\u5230\u6587\u4ef6\u4e2d\uff1a<\/p>\n<pre>SELECT * FROM table_name\nWHERE column_name = 'file_name.ext'\nINTO OUTFILE '\/path\/to\/file.ext'\nUSING LOB ('column_name');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5c06 table_name \u66ff\u6362\u4e3a\u5b58\u50a8 BLOB \u6570\u636e\u7684\u8868\u540d\u3002<\/li>\n<li>\u5c06 column_name \u66ff\u6362\u4e3a BLOB \u5217\u7684\u540d\u79f0\u3002<\/li>\n<li>\u5c06 \/path\/to\/file.ext \u66ff\u6362\u4e3a\u8981\u521b\u5efa\u7684\u6587\u4ef6\u7684\u8def\u5f84\u548c\u6587\u4ef6\u540d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u786e\u8ba4\u5bfc\u51fa\u3002<\/strong><\/p>\n<ul>\n<li>\u6267\u884c SELECT DBMS_LOB.FILEEXISTS(&#8216;\/path\/to\/file.ext&#8217;) FROM DUAL; \u67e5\u8be2\u4ee5\u9a8c\u8bc1\u6587\u4ef6\u662f\u5426\u5df2\u521b\u5efa\u3002\u5982\u679c\u7ed3\u679c\u4e3a 1\uff0c\u5219\u6587\u4ef6\u5df2\u5bfc\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u5bfc\u51fa\u540d\u4e3a image.jpg \u7684 BLOB \u6570\u636e\u5230\u6587\u4ef6 \/tmp\/image.jpg\uff1a<\/p>\n<pre>SELECT *\nFROM images\nWHERE image_id = 1\nINTO OUTFILE '\/tmp\/image.jpg'\nUSING LOB ('image');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u76ee\u6807\u6587\u4ef6\u5177\u6709\u8db3\u591f\u7684\u6743\u9650\u4ee5\u4f9b Oracle \u8fdb\u7a0b\u5199\u5165\u3002<\/li>\n<li>\u5982\u679c BLOB \u6570\u636e\u975e\u5e38\u5927\uff0c\u5bfc\u51fa\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u82b1\u8d39\u65f6\u95f4\u3002<\/li>\n<li>\u5bfc\u51fa\u7684\u6587\u4ef6\u662f\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u4e0d\u80fd\u76f4\u63a5\u6253\u5f00\u6216\u67e5\u770b\u3002\u9700\u8981\u4f7f\u7528\u652f\u6301\u4e8c\u8fdb\u5236\u6570\u636e\u7684\u5e94\u7528\u7a0b\u5e8f\u6765\u8bbf\u95ee\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5bfc\u51fablob\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>oracle \u4e2d\u5bfc\u51fa blob \u6570\u636e\u7684\u6b65\u9aa4\uff1a\u8fde\u63a5\u5230 oracle \u6570\u636e\u5e93\u3002\u521b\u5efa\u5bfc\u51fa\u6587\u4ef6\u3002\u6267\u884c\u5bfc\u51fa\u67e5\u8be2\uff1aselect * from table_name where column_name = &#8216;file_name.ext&#8217; into outfile &#8216;\/path\/to\/file.ext&#8217; using lob (&#8216;column_name&#8217;);\u786e\u8ba4\u5bfc\u51fa\uff1aselect dbms_lob.fileexists(&#8216;\/path\/to\/file.ext&#8217;) from dual; \u5982\u4f55\u5728 Oracle \u4e2d\u5bfc\u51fa BLOB BLOB\uff08\u4e8c\u8fdb\u5236\u5927\u5bf9\u8c61\uff09\u662f\u7528\u4e8e\u5b58\u50a8\u4e8c\u8fdb\u5236\u6570\u636e\u7684 Oracle \u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u9700\u8981\u5c06 BLOB \u6570\u636e\u4ece Oracle \u6570\u636e\u5e93\u4e2d\u63d0\u53d6\u5230\u6587\u4ef6\uff0c\u5219\u9700\u8981\u4f7f\u7528\u5bfc\u51fa\u529f\u80fd\u3002 \u6b65\u9aa4\uff1a \u8fde\u63a5\u5230 Oracle \u6570\u636e\u5e93\u3002 \u4f7f\u7528 SQL*Plus\u3001SQL Developer \u6216\u5176\u4ed6 Oracle \u5ba2\u6237\u5de5\u5177\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002 \u521b\u5efa\u5bfc\u51fa\u6587\u4ef6\u3002 \u5728\u76ee\u6807\u7cfb\u7edf\u4e0a\u521b\u5efa\u6587\u4ef6\u6765\u5b58\u50a8 BLOB \u6570\u636e\u3002\u6587\u4ef6\u6269\u5c55\u540d\u53ef\u4ee5\u4e3a .blob\u3001.bin \u6216\u4efb\u4f55\u5176\u4ed6\u4e0e\u4e8c\u8fdb\u5236\u6570\u636e\u5173\u8054\u7684\u6269\u5c55\u540d\u3002 \u6267\u884c\u5bfc\u51fa\u67e5\u8be2\u3002 \u6267\u884c\u4ee5\u4e0b\u67e5\u8be2\u4ee5\u5c06 BLOB \u6570\u636e\u5bfc\u51fa\u5230\u6587\u4ef6\u4e2d\uff1a SELECT * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5329","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5329"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5329\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}