Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: LONG RAW
Hi Charlie,
Please see the attached code....
Muthu Arul
New Jersey
Sample PL/SQL script that shows how to calculate the length of the long datatype using dbms_output and utl_raw packages.
If you have a table (a) with a long datatype (a2), one way to get its
length
is to use the utl_raw.length together with the dbms_output.put_line
functions
to display the length onscreen. Another workaround is to store the length
information itself in another database column (a3). The second option is
advisable if long column is > 64k. The script below is a quick example of
how
both of the above workarounds can be implemented.
To use the utl_raw package, you have to run the utlraw.sql and the
prvtrawb.plb
scripts. These scripts are located in the $ORACLE_HOME\RDBMS\ADMIN
directory.
DECLARE
vRaw number;
vCount number;
CURSOR a1 is
SELECT a1,
a2
FROM a
ORDER BY a1;
BEGIN
vRaw :=0;
FOR arec in a1 LOOP
vRaw := utl_raw.length(arec.a2);
vCount :=0;
dbms_output.put_line (arec.a1||' '||vRaw);
update a set a3 = to_char(vRaw) where a1 = arec.a1; If vCount <= 5 Then vCount := vCount + 1; Else vCount := 0; COMMIT; End If;
END LOOP;
END;
/
> -----Original Message-----
> From: Charlie Mengler
> Sent: Wednesday, January 10, 2001 1:55 PM
> To: Multiple recipients of list ORACLE-L
> Subject: LONG RAW
>
> I'm supporting a 3rd party s/w application on an Oracle V8.1.6 instance.
> One table is highly fragmented and contains a LONG RAW field.
>
> Other than export/import what are some ways of doing a "reorg" of this
> table?
>
> Along these lines does anyone have a PL/SQL function or similar code
> that will return the size of the a LONG RAW field?
>
> Please keep in mind that since this is a purchased application,
> I have no control over the data types used within Oracle.
>
> TIA!
>
> --
> Charlie Mengler Maintenance Warehouse
> charliem_at_mwh.com 10641 Scripps Summit Ct
> 858-831-2229 San Diego, CA 92131
> While there are NO stupid questions, why am
> I plagued with LOTS of inquisitive idiots.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Charlie Mengler
> INET: charliem_at_mwh.com
>
> 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: ListGuru_at_fatcity.com (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
Received on Wed Jan 10 2001 - 13:52:18 CST
![]() |
![]() |