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/16
Message-ID: <5bkgc5$f7p$1@nadine.teleport.com>#1/1

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.

Jonathan Ingram
Meridian Technology Group
503.639.0816 Received on Thu Jan 16 1997 - 00:00:00 CST

Original text of this message

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