oracle 如何从 sqldeveloper 中的插入语句插入 BLOB 列?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7489359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:33:35  来源:igfitidea点击:

How can I insert into a BLOB column from an insert statement in sqldeveloper?

oraclebloboracle-sqldeveloper

提问by chris

Is it possible to insert into a BLOBcolumn in oracle using sqldeveloper?

是否可以BLOB使用 sqldeveloper插入到oracle 中的列中?

i.e. something like:

即类似:

insert into mytable(id, myblob) values (1,'some magic here');

回答by Nicolas Filotto

To insert a VARCHAR2into a BLOBcolumn you can rely on the function utl_raw.cast_to_rawas next:

要将 a 插入VARCHAR2BLOB列中,您可以依赖该函数,utl_raw.cast_to_raw如下所示:

insert into mytable(id, myblob) values (1, utl_raw.cast_to_raw('some magic here'));

It will cast your input VARCHAR2into RAWdatatype without modifying its content, then it will insert the result into your BLOBcolumn.

它会将您的输入VARCHAR2转换为RAW数据类型而不修改其内容,然后将结果插入到您的BLOB列中。

More details about the function utl_raw.cast_to_raw

有关该功能的更多详细信息 utl_raw.cast_to_raw

回答by Codo

Yes, it's possible, e.g. using the implicit conversion from RAW to BLOB:

是的,这是可能的,例如使用从 RAW 到 BLOB 的隐式转换:

insert into blob_fun values(1, hextoraw('453d7a34'));

453d7a34is 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.

453d7a34是一串十六进制值,首先显式转换为RAW数据类型,然后插入到BLOB列中。结果是 4 个字节的 BLOB 值。

回答by Sumanth Pandugula

  1. insert into mytable(id, myblob) values (1,EMPTY_BLOB);
  2. SELECT * FROM mytable mt where mt.id=1 for update
  3. Click on the Lock icon to unlock for editing
  4. Click on the ... next to the BLOB to edit
  5. Select the appropriate tab and click open on the top left.
  6. Click OK and commit the changes.
  1. 插入 mytable(id, myblob) 值 (1,EMPTY_BLOB);
  2. SELECT * FROM mytable mt where mt.id=1 for update
  3. 单击锁定图标以解锁进行编辑
  4. 单击 BLOB 旁边的 ... 进行编辑
  5. 选择适当的选项卡,然后单击左上角的打开。
  6. 单击确定并提交更改。