DECLARE
    my_long_var                     LONG;
    len_long_var                     VARCHAR2(10);
   
   CURSOR get_rec
        IS
      SELECT key_column,
                    long_column
      FROM  table_name
      ORDER BY key_column;

BEGIN
    FOR x_rec IN get_rec
       LOOP
          my_long_var := x_rec. long_column;    
          len_long_var := LENGTH(my_long_var);
          dbms_output.put_line ('my_long_var = '  || LENGTH(my_long_var));
        END LOOP;
END;

I added a VARCHAR2 column to my table and used the key_column to update the
VARCHAR2 column with the length of the long_column. Don't ask why !!!

Al Rusnak
804-734-8453
[EMAIL PROTECTED]

 -----Original Message-----
Sent:   Tuesday, March 19, 2002 5:43 PM
To:     Multiple recipients of list ORACLE-L
Subject:        Re: Length of LONG datatype - ANSWER

I'll address your second question, because I don't know, offhand, the
answer to the first!

IMO, there's almost no advantage to using LONG.  There are many
restrictions on its use (e.g., only one LONG in a table), you can't
apply a function to a LONG column, you can't use it in a set operation,
etc.  In addition, Oracle says that the LONG datatype will soon be
phased out.  

If you can fit your data into 4000 or fewer characters, use VARCHAR2. 
If not, go for CLOB/BLOB, which require a little more overhead, but are
much more useable than LONG.

Paul Baumgartel
Adept Computer Associates, Inc.
[EMAIL PROTECTED]

--- "Rusnak, George A." <[EMAIL PROTECTED]> wrote:
> Group,
> Please share with me a way to determine the actual length of data in
> a LONG
> data type. As a follow on, what are the pros/cons of using LONG vs.
> CLOB or
> VARCHAR2 ??
> 
> TIA
> 
> Al Rusnak
> 804-734-8453
> [EMAIL PROTECTED]
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Rusnak, George A.
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing
> Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Paul Baumgartel
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rusnak, George A.
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to