首先添加一个运行 xml 函数的 VP:
onmode -p +1 idsxmlvp
测试
create table lilei(xml_c lvarchar(32000));
execute procedure ifx_allow_newline('t');
insert into lilei(xml_c)
values("
1
a
2
b
3
c
");
例1:select first 1 c1 from table; 转成
select extractvalue(xml_c,'/test_table/row[1]/c1') zd1 from lilei;
结果:
zd1 1
例2:select c1 from table;转成
select extract(xml_c,'/test_table/row/c1') from lilei;
结果:
(expression) 123
例3:select c1,c2 from table;转成
select
replace(replace(extract(xml_c,'/test_table/row/c1'),'' ,''),'','
') c1,
replace(replace(extract(xml_c,'/test_table/row/c2'),'' ,''),'','
') c2
from lilei;
结果:
c1 1
2
3
c2 a
b
c
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22565551/viewspace-1036459/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22565551/viewspace-1036459/