In a .NET Datatable, the columns are Object types, which can include a datatable as a valid type for a column. So you can create a fairly complex structure:
CompanyID (Integer) | CompanyName (String) | OrderRecords (DataTable) --------------------------------------------------------------------------- 1 | Acme Corp. | DataTable of Orders
When calling an Oracle stored procedure, is there any way to return such a structure. I tried using the inline views, but it wouldn’t let me. Example:
refCursor IS ref CURSOR; PROCEDURE GETCOMPANYLIST ( CompanyCursor OUT refCursor ) AS BEGIN Open CompanyCursor For SELECT COMPANYID, COMPANYNAME, (SELECT * FROM ORDERS WHERE CompanyID = CompanyID) OrderRecords WHERE IsActive = 'T'; END GETCOMPANYLIST;
This doesn’t work, but is there any way to do what I am trying to do here? Currently, I have to get back the List of Companies in one call to the database, then loop through all the records and make individual calls to get each list of Orders.
[Added valid answer – until now there was no answer actually answering the question]
I needed to do something similar once, and ended up returning them all as OUT REF CURSOR’s, one for each result set. This could be loaded into a DataSet if preferred.