4

I need to append data to my BLOB field, how can I do this using an update? What I am asking is; is it possible to concatenate blob data so that I can update a blob field with this new data. Something like:

UPDATE BLOB_table 
   SET BLOB_field = BLOB_field + BLOB_data

1 Answer 1

6

Concat should work..

UPDATE BLOB_table SET BLOB_field = CONCAT(BLOB_field, BLOB_data);

I tested with this:

CREATE TABLE `Blobs` (
  `id` int(11) NOT NULL,
  `b` blob,
  PRIMARY KEY  (`id`)
) 

insert into Blobs values (1, "heel");

update Blobs set b = concat(b, "heelele");

Maybe this just works since I paste strings into the Blob...

Sign up to request clarification or add additional context in comments.

3 Comments

No, its not working for me. If you have some code snippet then please share.
Looks like someone else has made it work: grokbase.com/t/mysql/mysql/996xt29byb/blobs-and-concat
This often runs into the error "Result of CONCAT exceeds max-packet_size". Basically, it's not possible to stream large data into and out of MySQL/MariaDB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.