I'm using Perl DBI to access an Oracle database.
I'm trying to get the actual maximum size of the columns returned from a query, so I can better format the output. I'm working with user-entered queries, so I don't have the luxury of knowing tables and columns in advance. I know that this:
will return the declared length of a field, but not the max size from the answer set.
select max(length(<col>)) from <table>
returns the largest entry for a given column which is close to what I need. I'm working with user-entered data, though, and I'm not sure how to get the tables and columns, to use in the above query.
Has anyone had success doing this? My last resort is to load the entire answer set in an array and find the max size by brute force, but that will be really inefficient with a large answer set.