Does anybody know if there is a way to find what the length of the longest row in a column in Oracle?
Basically I need to get the length of the longest row and then
To make the maxlength useable you may want to get it from a imbedded select
select <do something with maxlength here>
from
(select x.*,
( select max(length(yourcolumn)) from yourtable) as maxlength
from yourtable x)
This should do what you want:
select max(length(MyColumn)) from MyTable;
Depending on what you are trying to achieve, you may also be insterested to know that you can output the data in the column plus exactly one space like this:
select rtrim(MyColumn)||' ' from MyTable;
To pad all values in a column to the longest value +1 you can do:
SELECT RPAD( column_name ,(SELECT MAX(LENGTH( column_name ))+1 FROM table)) FROM table;