0

I have problem exactly like the post: Parse xmltype into table after pivot xml

I want to use pivot xml and then parse the xml (maybe with xmltable function) to table. What can I do if I don't know the countries name and how many countries exist?

Thanks!

  • You would need to use a dynamic pivot rather than an XML pivot; but this is probably something you should do in a reporting layer. – Alex Poole Jul 08 '20 at 13:39
  • Do you have maybe an example? – Maayan Paz-Chen Jul 09 '20 at 08:48
  • [Here's one](https://stackoverflow.com/a/17576182/266304), and there are many others, but you'll have to adapt to your data and query. – Alex Poole Jul 09 '20 at 08:54
  • thanks! honestly i still didn't succuess. I used the example that you sent , added:"SET SERVEROUTPUT ON;" , use sql-developer but nothing is printed on the screen. – Maayan Paz-Chen Jul 12 '20 at 09:22
  • @AlexPoole Do you know maybe? – Maayan Paz-Chen Jul 12 '20 at 19:31
  • That example doesn't use server output. The results are returned via a ref cursor, which is a bind variable - declared with `variable` and displayed with `print`. You need to run as a script, but you'd get prompts or errors if you didn't. I suggest you try to adapt something like that, and if you can't then ask a new question including the code you're using, sample data and expected results (all as formatted text, not images). – Alex Poole Jul 12 '20 at 21:13
  • @AlexPoole thank you! works! :) now I need to create new question and ask if it's possible to run that also from excel (through get ODBC data) – Maayan Paz-Chen Jul 13 '20 at 10:15

0 Answers0