Is it possible to insert into a BLOB
column in oracle using sqldeveloper?
i.e. something like:
insert into mytable(id, myblob) values (1,'some magic here');
Is it possible to insert into a BLOB
column in oracle using sqldeveloper?
i.e. something like:
insert into mytable(id, myblob) values (1,'some magic here');
Yes, it's possible, e.g. using the implicit conversion from RAW to BLOB:
insert into blob_fun values(1, hextoraw('453d7a34'));
453d7a34
is a string of hexadecimal values, which is first explicitly converted to the RAW data type and then inserted into the BLOB column. The result is a BLOB value of 4 bytes.
To insert a VARCHAR2
into a BLOB
column you can rely on the function utl_raw.cast_to_raw
as next:
insert into mytable(id, myblob) values (1, utl_raw.cast_to_raw('some magic here'));
It will cast your input VARCHAR2
into RAW
datatype without modifying its content, then it will insert the result into your BLOB
column.
More details about the function utl_raw.cast_to_raw
UTL_RAW.CAST_TO_RAW
has a limit of 2000 chars. How to insert a value > 2000 chars ? (used on Oracle) –
Slurp to_clob
function. check this answer: https://mcmap.net/q/390310/-how-to-write-oracle-insert-script-with-one-field-as-clob –
Archeology Yes, it's possible, e.g. using the implicit conversion from RAW to BLOB:
insert into blob_fun values(1, hextoraw('453d7a34'));
453d7a34
is a string of hexadecimal values, which is first explicitly converted to the RAW data type and then inserted into the BLOB column. The result is a BLOB value of 4 bytes.
Using SQL DEVELOPER you can add the record with an insert like this
Insert into MY_TABLE (KEYSTRING,BLOB) values (123, '');
After that you can save blob content (a big string>4000 char for example) into a file.txt
upload it from SQL DEVELOPER
© 2022 - 2024 — McMap. All rights reserved.