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
w/o function:
select
rpad(tbl.column_name, length_info.max_length+1, ' ') as target_string
from
table_name tbl,
(
select max(length(column_name)) max_length
from my_table
)
length_info
with your function:
select
rpad(tbl.column_name, MaxLengthFunc + 1, ' ') as target_string
from
my_table tbl
declare your function as determinictic for better performance:
create or replace function MaxLengthFunc
return number
deterministic
as
vMaxLen number;
begin
select max(length(column_name))
into vMaxLen
from table_name;
return vMaxLen;
end;