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
How can I insert into a BLOB column from an insert statement in sqldeveloper?
提问by chris
Is it possible to insert into a BLOB
column 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 VARCHAR2
into a BLOB
column you can rely on the function utl_raw.cast_to_raw
as next:
要将 a 插入VARCHAR2
到BLOB
列中,您可以依赖该函数,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 VARCHAR2
into RAW
datatype without modifying its content, then it will insert the result into your BLOB
column.
它会将您的输入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'));
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.
453d7a34
是一串十六进制值,首先显式转换为RAW数据类型,然后插入到BLOB列中。结果是 4 个字节的 BLOB 值。
回答by Sumanth Pandugula
- insert into mytable(id, myblob) values (1,EMPTY_BLOB);
- SELECT * FROM mytable mt where mt.id=1 for update
- Click on the Lock icon to unlock for editing
- Click on the ... next to the BLOB to edit
- Select the appropriate tab and click open on the top left.
- Click OK and commit the changes.
- 插入 mytable(id, myblob) 值 (1,EMPTY_BLOB);
- SELECT * FROM mytable mt where mt.id=1 for update
- 单击锁定图标以解锁进行编辑
- 单击 BLOB 旁边的 ... 进行编辑
- 选择适当的选项卡,然后单击左上角的打开。
- 单击确定并提交更改。