我有一个名为:“ userdetails”的表,其中包含列“ username”和“ placename”。数据如下:
Username placename
Testuser1 India-chennai
Testuser2 India-delhi
Testuser3 UK-London
现在,我想知道两列的最大数据长度。像下面一样
username placename
9 13 - which (India-chennai)
是否有可能将其识别出来。我已经尝试了以下查询,但未产生所需的输出:
select data_type, data_length
from user_tab_columns
where table_name = 'userdetails'
and column_name in ('Username', 'placename');
答案 0 :(得分:1)
如果要获取现有数据的最大数据值,请尝试以下查询
Select max(length(Username)) as max_username, max(length(placename)) as max_placename
from userdetails