sql - Update xml tag in Oracle - joining another table -


i found following link useful, ask further it

update xml tag in clob column in oracle

using same data in previous post:

create table tmp_tab_noemail_test (sce_msg clob); insert tmp_tab_noemail_test values ( '<energy xmlns="http://euroconsumers.org/notifications/2009/01/notification">         <gender>m</gender>     <firstname>mar</firstname>     <name>van hall</name>     <email/><telephone>000000000</telephone>     <insertdate>2013-10-09</insertdate> </energy>');  update tmp_tab_noemail_test p1  set p1.sce_msg = updatexml(xmltype(p1.sce_msg),   '/energy/insertdate/text()','not valid',   'xmlns="http://euroconsumers.org/notifications/2009/01/notification"').getclobval(); 

now, if wanna table account. has column: acct_num, name, date_of_birth

how can update insertdate tag value = account.date_of_birth name tag value = account.name?

is possible do? thanks!

if correctly understood question, can extract name , rowid tmp_tab_noemail_test, join them account table, updated xml , using merge (by rowid) update in destination folder -

create table account (acct_num varchar2(20), name varchar2(255), date_of_birth date);  insert account values(123, 'van hall', sysdate); commit;  merge tmp_tab_noemail_test t using ( select rid, updatexml(xmltype(sce_msg),         '/energy/insertdate/text()', to_char(date_of_birth, 'yyyy-mm-dd'),         'xmlns="http://euroconsumers.org/notifications/2009/01/notification"').getclobval() sce_msg     (select t.sce_msg, t.rid, t.name, a.date_of_birth             (select sce_msg, extractvalue(xmltype(sce_msg),                  '/energy/name',                  'xmlns="http://euroconsumers.org/notifications/2009/01/notification"') name,                 rowid rid         tmp_tab_noemail_test) t, account     t.name = a.name) ) s on (t.rowid = s.rid) when matched update set    t.sce_msg = s.sce_msg; 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -