Re: How long are my LONGs?
Date: 22 Oct 92 12:46:14 GMT
Message-ID: <RNq2sB3w164w_at_cellar.org>
mharper_at_well.sf.ca.us (Michael J. Harper) writes:
> Now that I have added my solitary LONG column to a table, is there a way
> to find out how LONG the data is on a per row basis? Silly me, I thought
> I could use something like LENGTH() or VSIZE(), but both choke when given
> the name of a LONG column. I am looking for the length of the *actual data*,
> not the maximum length of a LONG column.
>
Well, you've hit the same wall everyone else has. You have to use a procedural language. The example I'll give works in PL/SQL. You could also use SQR or ProC. What you have to do is read the LONG value into a variable, then calculate the length of that variable's value. In Pl/SQL, you have to store the result in a table to save it. PL/SQL allows you to read longs into char(32767)'s, as shown below. In this example, I'm grabbing the primary key (cdcno) and the length of the LONG field to store in my result table.
declare
cdcno char(8);
longvar char(32767); /*to hold the LONG value*/
longval number; /*length of LONG*/
cursor longcheck is
select cdc_doc_no, abstract from cdc;
begin
open longcheck;
LOOP
fetch longcheck into cdcno, longvar; /*read into local variables*/
EXIT WHEN LONGCHECK%NOTFOUND;
longval:= length(longvar); /*get length of character string*/ insert into testtable(cdc_doc_no,longval) values (cdcno,longval); /*store result in table*/end loop;
CLOSE LONGCHECK;
commit;
end;
/
Kevin.
Something constructive should come here. $dump ora_control1/blocks=(start:1,end:1) Vidi, Vici, Veni!kml%cellar_at_tredysvr.tredydev.unisys.com - My other account is a Mercedes. Received on Thu Oct 22 1992 - 13:46:14 CET