Is there a way to get this XML from “select * from ANY_TABLE” query?
<root>
<row>
<column name="id" value="321">
<column name="name" value="Book">
</row>
<row>
<column name="id" value="654">
<column name="name" value="Pen">
</row>
</root>
Here is a way to get the result you want.
If you want this to work for any table using
select *you can use this instead.Just replace
@Twith whatever your table name is. Note: this will only work if the column names are valid XML element names.