我有一個名爲employee(id number, deatils XML)
的表,並且deatils列可以爲空。IBM DB2 XML列更新並還原爲空
讓我們說,我已經插入下面的數據
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工具,它有一個知道是不是BUG,不會複製/還原該數據到其他模式,因爲在第二行空的。雖然提取數據可以很好地提取,但插入到其他模式將失敗。
解決此問題的方法是使用某個虛擬xml更新空值,插入數據並在traget數據庫中用null替換虛擬xml。我需要db2查詢來做到這一點。
我做
update employee set details='<xml></xml>' where details=null;
此更新,我可以提取數據,並插入到目標,但是當我嘗試更新虛擬XML我收到錯誤後。
讓我們說,我已經試過像下面(這不會工作)
update employee set deatils=null where details='<xml></xml>';
基本上DB2無法與我的where子句中找到任何記錄,由於存儲爲CLOB XML。
請幫忙!
代替'更新僱員設置細節= XMLPARSE(文件(」 XML ')),其中的細節= NULL;'我可以使用UDPATE'僱員設置細節=' foo '哪裏的細節是空的,但我怎麼能做到相反? –
Satesh