{"id":40191,"date":"2025-10-15T04:18:16","date_gmt":"2025-10-15T04:18:16","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=40191"},"modified":"2025-10-15T05:05:12","modified_gmt":"2025-10-15T05:05:12","slug":"oracle-update-blob","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/blob\/oracle-update-blob.html","title":{"rendered":"Oracle Update BLOB"},"content":{"rendered":"<p>Updating a BLOB (Binary Large Object) in Oracle can be achieved using several methods.<\/p>\n<p>1. Updating with a Buffer (Direct Data):<\/p>\n<pre>UPDATE your_table\r\nSET your_blob_column = :new_blob_data\r\nWHERE primary_key_column = :key_value;\r\n<\/pre>\n<p>2. Updating by Selecting a LOB from Another Table or Source:<\/p>\n<pre>UPDATE your_table\r\nSET your_blob_column = (SELECT source_blob_column FROM source_table WHERE some_condition)\r\nWHERE primary_key_column = :key_value;\r\n<\/pre>\n<p>3. Updating with EMPTY_BLOB():<\/p>\n<pre>UPDATE your_table\r\nSET your_blob_column = EMPTY_BLOB()\r\nWHERE primary_key_column = :key_value;\r\n<\/pre>\n<p>4. Updating a BLOB field with the contents of a file:<\/p>\n<pre>CREATE DIRECTORY MY_DIR AS '\/directory\/subdirectory';\r\n\r\nDECLARE\r\n\tsrc_bfile BFILE := BFILENAME('MY_DIR', 'filename.txt');\r\n\tdest_blob BLOB;\r\nBEGIN\r\n\tSELECT BLOBCOL into dest_blob FROM BLOBTABLE WHERE ROWID = 'ROWIDVALUE';\r\n\r\n\tDBMS_LOB.OPEN(src_bfile, DBMS_LOB.LOB_READONLY);\r\n\tDBMS_LOB.LoadFromFile( DEST_LOB =&gt; dest_blob,\r\n\tSRC_LOB =&gt; src_bfile,\r\n\tAMOUNT =&gt; DBMS_LOB.GETLENGTH(src_bfile) );\r\n\tDBMS_LOB.CLOSE(src_lob);\r\n\r\n\tCOMMIT;\r\nEND;\r\n\/\r\n<\/pre>\n<p>And you can use <a href=\"https:\/\/www.withdata.com\/dbblobeditor\/\">DBBlobEditor <\/a>to <a href=\"https:\/\/www.withdata.com\/blog\/oralobeditor\/how-to-batch-update-oracle-blob-data-from-files.html\">Batch update Oracle table BLOB data from files<\/a>.<\/p>\n<p>See also: <a href=\"https:\/\/www.withdata.com\/blog\/blob\/oracle-blob.html\">Oracle BLOB<\/a>, <a href=\"https:\/\/www.withdata.com\/blog\/oralobeditor\/edit-oracle-blob-data.html\">View and edit BLOB data stored in Oracle<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updating a BLOB (Binary Large Object) in Oracle can be achieved using several methods. 1. Updating with a Buffer (Direct Data): UPDATE your_table SET your_blob_column = :new_blob_data WHERE primary_key_column = :key_value; 2. Updating by Selecting a LOB from Another Table or Source: UPDATE your_table SET your_blob_column = (SELECT source_blob_column FROM source_table WHERE some_condition) WHERE primary_key_column [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4524],"tags":[97,1325],"class_list":["post-40191","post","type-post","status-publish","format-standard","hentry","category-blob","tag-blob","tag-oracle"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=40191"}],"version-history":[{"count":3,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40191\/revisions"}],"predecessor-version":[{"id":40200,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/40191\/revisions\/40200"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=40191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=40191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=40191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}