Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to determine the length of the biggest varchar2 column in a table?

Re: How to determine the length of the biggest varchar2 column in a table?

From: Jonathan W. Ingram <jingram_at_teleport.com>
Date: 1997/01/19
Message-ID: <5buats$a9q$1@nadine.teleport.com>#1/1

On Thu, 16 Jan 1997 05:58:42 GMT, I wrote:

>On Wed, 15 Jan 1997 00:53:57 GMT, max_at_virtualf.com (Maxwell MacLeod)
>wrote:
 

>>does anyone know how to do this? For example, if I had a field "name",
>>which is varchar2(2000). One value is "Max" and another "Jeromino", I
>>need to know the length of Jeromino.
 

>This is very simple, although a bit performance draining :-)
 

> SELECT length (name)
> FROM <table_name>
> WHERE length (name) =
> (SELECT max (length (name))
> FROM <table_name>);
 

>This will return multiple rows, if two or more strings have the same
>length. Remember, this is not an efficient query to run.
It's not often I find myself responding tomy own posts, but this answer was so moronic that I had to respond to it. The correct query is

SELECT max (length (name))
FROM <table_name>;

Sorry, I guess it was some sort of brain-stuck mode thing.

>Jonathan Ingram
>Meridian Technology Group
>503.639.0816
Received on Sun Jan 19 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US