Need help with script to get resource data from database

Started by thelonejedi, Aug 17, 2023, 09:14 PM

Previous topic - Next topic

thelonejedi

So far I have this but when trying to covert this to XML it doesn't separate enough data info into groups.

SELECT resource_id, resource_name, resource_class, regexpsubstr(attributes, '[[:alpha:]]+', 1, lines.column_value) attribute_name, regexp_substr(attributes, '\d+', 1, lines.column_value) attribute_value FROM resource_types, TABLE (CAST (MULTISET (SELECT LEVEL FROM dual CONNECT BY regexp_substr(attributes, '[^:]+', 1, LEVEL) IS NOT NULL) AS sys.odciNumberList)) lines WHERE depleted_timestamp >= (SELECT last_save_time FROM clock);

Can anyone help please

thelonejedi

Shozzo

I don't what database this is pulling from, but from SQL Server you would add FOR XML AUTO; to the end of the query for it to return as XML.
If this is MySQL or Oracle you'd have to google how to get the results to return as XML.