Home » SQL & PL/SQL » SQL & PL/SQL » size of long column?
size of long column? [message #36310] Thu, 15 November 2001 11:33 Go to next message
Ronnie
Messages: 3
Registered: November 2001
Junior Member
How can you determine if a long column is larger or smaller than 32K (i.e. for use in a cursor)? Thanks.

----------------------------------------------------------------------
Re: size of long column? [message #36329 is a reply to message #36310] Fri, 16 November 2001 08:41 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Tyry playing with this code. Change the local var to LONG, then try to poplulate it with the first 32k. If length() = 32k, then you'd guess that the original contents at > 32k

DECLARE
CURSOR datacursor IS SELECT long_col FROM long_tab;
datarecord datacursor%ROWTYPE;
v_text VARCHAR2(1000); -- up to 4000 Ora8, 2000 Ora7
BEGIN
OPEN datacursor;
LOOP
FETCH datacursor INTO datarecord;
EXIT WHEN (datacursor%NOTFOUND);
v_text := SUBSTR(datarecord.long_col, 1, 1000);
DBMS_OUTPUT.put_line('Length is :'||LENGTH(datarecord.long_col));
END LOOP;
END;
/

----------------------------------------------------------------------
Previous Topic: can I create cursors as arrey?
Next Topic: Evaluating Logical Expression
Goto Forum:
  


Current Time: Tue Apr 23 09:30:06 CDT 2024