【发布时间】:2011-09-15 21:31:12
【问题描述】:
我有一个名为 employee(id number, deatils XML) 的表,并且 deatils 列可以为空。
假设我插入了以下数据
insert into employee(1, '<xml><employee><name>Foo</name></employee></xml>');
insert into employee(2, null);
insert into employee(3, '<xml><employee><name>Bar</name></employee></xml>');
我有一个 IBM Optim 工具,它有一个已知错误,由于第二行中的 null ,它不会将此数据复制/恢复到其他模式中。虽然提取数据可以正常提取,但插入其他模式会失败。
解决方法是使用一些虚拟 xml 更新 null 值,插入数据并在 traget 数据库中用 null 替换该虚拟 xml。我需要 db2 查询才能这样做。
我在做
update employee set details='<xml></xml>' where details=null;
在此更新之后,我可以提取数据并插入到目标中,但是当我尝试更新虚拟 xml 时出现错误。
假设我已经尝试过下面的方法(这不会起作用)
update employee set deatils=null where details='<xml></xml>';
由于 xml 存储为 clob,基本上 db2 无法使用我的 where 子句找到任何记录。
请帮忙!
【问题讨论】: