Oracle下RowType与XML文件的联合处理
今天在处理Oracle数据,XML结合ROWTYPE,将数据写入物理表中,很有意思,演示代码如下:
declare
v_temp t_temp%ROWTYPE;
cursor c_temp is select * from
(select extractValue(value(n),'/row/cid') a1
from TABLE (xmlSequence(extract(
xmltype('<rows><row><cid>123</cid><cname>fdf</cname></row></rows>'),'/rows/*'))) n) ;
BEGIN
OPEN c_temp;
LOOP
FETCH c_temp into v_temp;
EXIT WHEN c_temp%NOTFOUND;
insert into T_TEMP1 VALUES v_temp;
END LOOP;
CLOSE c_temp;
END;