I have a database table and I need to utilize the data in the table to tell me about segment sizes for the tables listed in the database table.
Here's an example of the kind of data in there, it's broken up into 4 columns and there are many rows:
TABLE_A TABLE_B JOIN_COND WHERE_CLAUSE
AZ AT A.AR_ID = B.AR_ID A.DE = 'AJS'
AZ1 AT1 A.AR_ID = B.AR_ID A.DE = 'AJS' AND B.END_DATE > '30-NOV-2015'
AZ2 AT3 A.AR_ID = B.AR_ID A.DE = 'AJS' AND B.END_DATE > '30-NOV-2015'
Here's what I need to accomplish:
- Some sort of loop perhaps? That finds the size of each single "TABLE_A" in kilobytes.
- Build a query that would find an estimate of the data (space) that would be needed to create a new table based on a subset of a query something like this:
...
SELECT *
FROM TABLE_A a, TABLE_B b
WHERE A.AR_ID = B.AR_ID
AND A.FININS_CDE = 'AJS'
AND B.END_DTE > '30-NOV-2015'
... but for every row in the table. So at the end of the process if there were 100 rows in the table, I would get 200 results:
- 100 rows telling me the size of each table A
- 100 results telling me the size that would be taken up by the subset with the WHERE clause.