{"id":621,"date":"2011-09-15T15:40:06","date_gmt":"2011-09-15T07:40:06","guid":{"rendered":"http:\/\/j178.mtgbb.com\/?p=621"},"modified":"2011-09-15T15:42:35","modified_gmt":"2011-09-15T07:42:35","slug":"plsql-%e7%b7%a8%e7%a2%bc-%e8%a7%a3%e6%9e%90-xml","status":"publish","type":"post","link":"https:\/\/j178.mtgbb.com\/?p=621","title":{"rendered":"PL\/SQL \u7de8\u78bc \/ \u89e3\u6790 XML"},"content":{"rendered":"<p>sample code \u5982\u4e0b:<\/p>\n<pre lang=\"oracle8\" line=\"1\">\r\nDECLARE\r\n  v_xmldoc VARCHAR2(1000);\r\nBEGIN\r\n  -- \u5c07\u8cc7\u6599\u7de8\u78bc\u70ba XML DOC \u7d50\u69cb\r\n  dbms_output.put_line('-- \u986f\u793a\u7de8\u78bc\u7d50\u679c --');\r\n  SELECT dbms_xmlgen.getxmltype('\r\n           select 123 col1, 456 col2 from dual \r\n           union \r\n           select 789 col1, 159 col2 from dual\r\n        ').getclobval()\r\n    INTO v_xmldoc\r\n    FROM dual;\r\n\r\n  -- \u6e2c\u8a66\u7de8\u78bc\u7d50\u679c\r\n  dbms_output.put_line(v_xmldoc);\r\n\r\n  --- \u89e3\u6790\u8cc7\u6599, \u53ef\u5c07\u55ae\u4e00 xml string\/files \u91cd\u7d44\u70ba table\r\n  dbms_output.put_line('-- \u986f\u793a\u89e3\u6790\u7d50\u679c --');\r\n  FOR rr IN (SELECT extractvalue(column_value, '\/ROW\/COL1') column1,\r\n                    extractvalue(column_value, '\/ROW\/COL2') column2\r\n               FROM TABLE(xmlsequence(extract(xmltype(v_xmldoc),\r\n                                              '\/ROWSET\/ROW'))) tab) LOOP\r\n    dbms_output.put_line(rr.column1 || ',   ' || rr.column2);\r\n  END LOOP;\r\nEND;\r\n<\/pre>\n<p>\u76f8\u95dc\u7db2\u7ad9\u8cc7\u8a0a: <a href=\"http:\/\/martin-mares.com\/2010\/08\/oracle-db-how-to-processing-xml-with-multiple-nodes-xmlsequence\/\">Martin Mare\u0161 : blog<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>sample code \u5982\u4e0b: DECLARE v_xmldoc VARCHAR2(1000); BEGIN  &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,12],"tags":[23,57],"class_list":["post-621","post","type-post","status-publish","format-standard","hentry","category-oracle-erp","category-database","tag-oracle-db","tag-oracle-erp"],"_links":{"self":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=621"}],"version-history":[{"count":0,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/621\/revisions"}],"wp:attachment":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}