开发者

Oracle blob - inserting long (over 4000 hex-digits) data in sql command

开发者 https://www.devze.com 2023-01-15 21:42 出处:网络
How can I, in Oracle 11, insert large data (~100000 hex-digits) into Blob field, using sql command only (without any external data with load cluase or such).

How can I, in Oracle 11, insert large data (~100000 hex-digits) into Blob field, using sql command only (without any external data with load cluase or such).

update tablename set fieldname='AA';

Works - 1 byte;

update tablename set fieldname='AA...(4000 hex-digits)...AA';

Doesn't. Niether Concat helps; strings can't be larger than 4000 chars. Is there other 开发者_StackOverflow中文版way, using sql command only?


As far as I know it is not possible. What you can do is:

  1. select blob from table
  2. get blob from resultset
  3. get outputstream from blob
  4. write to stream
  5. flush and update blob in table
  6. commit

You should be able to replace steps 1-2 by creating a temporary blob and using that for writing and updating.


DECLARE
  buf RAW(100000);
BEGIN
  buf := hextoraw('626567696E2030207575656E636F64652E6275660D0A6');
  UPDATE tableName SET columnName = buf;
  --or
  INSERT INTO tableName(charColumn, BlobColumn) values ('Sting', buf);
END;
0

精彩评论

暂无评论...
验证码 换一张
取 消