Advertisement
eurismarpires

EXTRACAO_XML_ORACLE

Oct 3rd, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.42 KB | None | 0 0
  1. SELECT SYS.XMLTYPE.createxml('<FAQ-LIST>
  2.                <FAQ-ID>01</FAQ-ID>
  3.                <QUESTION>
  4.                     <QUERY>Question 1</QUERY>
  5.                     <RESPONSE>Answer goes here.</RESPONSE>
  6.                </QUESTION>
  7.                <QUESTION>
  8.                     <QUERY>Question 2</QUERY>
  9.                     <RESPONSE>Answer goes here.</RESPONSE>
  10.                </QUESTION>
  11.                <QUESTION>
  12.                     <QUERY>Question 3</QUERY>
  13.                     <RESPONSE>Answer goes here.</RESPONSE>
  14.                </QUESTION>
  15.             </FAQ-LIST>') FROM DUAL
  16.  
  17.  
  18.  
  19. SELECT * FROM              
  20. XMLTABLE ('/FAQ-LIST/QUESTION'
  21.                     PASSING (SYS.XMLTYPE.createxml('<FAQ-LIST>
  22.                <FAQ-ID>01</FAQ-ID>
  23.                <QUESTION>
  24.                     <QUERY>Question 1</QUERY>
  25.                     <RESPONSE>Answer goes here.</RESPONSE>
  26.                </QUESTION>
  27.                <QUESTION>
  28.                     <QUERY>Question 2</QUERY>
  29.                     <RESPONSE>Answer goes here.</RESPONSE>
  30.                </QUESTION>
  31.                <QUESTION>
  32.                     <QUERY>Question 3</QUERY>
  33.                     <RESPONSE>Answer goes here.</RESPONSE>
  34.                </QUESTION>
  35.             </FAQ-LIST>'))
  36.                     COLUMNS Question VARCHAR2(30) PATH 'QUERY',
  37.                             RESPONSE VARCHAR2(30) PATH 'RESPONSE') x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement