quicker way to find the length of a record
- From: Oxnard Montalvo <oxnard@xxxxxxxxxxxxxxx>
- To: Post to FreeList Oracle-L <Oracle-L@xxxxxxxxxxxxx>
- Date: Sat, 23 Feb 2008 11:14:58 -0500
version 10r2
declare
type rec_type is record(
c1 varchar2(1) not null := 'D'
,c2 number not null := 12345
);
rec rec_type;
type t is table of number index by pls_integer;
c t;
type rec2 is record(
c1 number
,c2 varchar2(10));
type rec2_type is table of rec2 index by pls_integer;
c2 rec2_type;
begin
select col bulk collect into c from
(select 121212121212121212129999 as col from dual
union all
select 221212121212121212121212121212 as col from dual);
dbms_output.put_line(length(c(1)));
select c1,c2 bulk collect into c2 from
(select 1 as c1,'bbbb' as c2 from dual
union all
select 2 as c1,'dkkdk' as c2 from dual);
-- dbms_output.put_line(length(c2(1))); -- fails
-- dbms_output.put_line(length(rec)); -- fails
dbms_output.put_line((length(rec.c1) + length(rec.c2))); -- works but a pain
end;
/
seems like the only way to obtain the length is to add all the pieces. The
adding is not bad on small records but large one is a bit of a pain. Any way
which would use less code to do this?
Thanks
Ox
--
http://www.freelists.org/webpage/oracle-l
- Follow-Ups:
- Re: quicker way to find the length of a record
- From: William Robertson
Other related posts:
- » quicker way to find the length of a record
- » Re: quicker way to find the length of a record
- Re: quicker way to find the length of a record
- From: William Robertson