oracle 如何从物理文件更新oracle sql developer中的CLOB列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31260154/
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 to update CLOB column in oracle sql developer from a physical file
提问by teenup
I have a CLOB
column in a table which holds very large amount of Xml Data. I need to update this column's value for one row of table. How can I do this?
我CLOB
在一个包含大量 Xml 数据的表中有一列。我需要为表格的一行更新此列的值。我怎样才能做到这一点?
I have tried googling, but this visibly simple stuff is not available in a simple language anywhere. Can anybody please suggest?
我试过谷歌搜索,但这种明显简单的东西在任何地方都没有简单的语言。有人可以建议吗?
If I use the normal update query syntax and paste the huge xml content inside the single quotes (the single quote in xml content replaced with 2 single quotes), then the sql developer just disables the execute query button.
如果我使用普通的更新查询语法并将巨大的 xml 内容粘贴到单引号内(xml 内容中的单引号替换为 2 个单引号),那么 sql 开发人员只是禁用了执行查询按钮。
update tableName t
set t.clobField = 'How to specify physical file data'
where t.anotherField='value';
回答by Rene
Search the internet for "load clob from file" and you will find a couple of examples. Such as this (http://www.anujparashar.com/blog/loading-text-file-into-clob-field-in-oracle):
在 Internet 上搜索“从文件加载 clob”,您会找到几个示例。比如这个(http://www.anujparashar.com/blog/loading-text-file-into-clob-field-in-oracle):
DECLARE
v_bfile BFILE;
v_clob CLOB;
BEGIN
v_bfile := BFILENAME (p_file_directory, p_file_name);
IF DBMS_LOB.FILEEXISTS (v_bfile) = 1 THEN
DBMS_LOB.OPEN (v_bfile);
DBMS_LOB.CREATETEMPORARY (v_clob, TRUE, DBMS_LOB.SESSION);
DBMS_LOB.LOADFROMFILE (v_clob, v_bfile, DBMS_LOB.GETLENGTH (v_bfile));
DBMS_LOB.CLOSE (v_bfile);
INSERT INTO tbl_clob (clob_col)
VALUES (v_clob);
END IF;
COMMIT;
END;
/