Hi there,
I require help here...
declare
TYPE BLK_dt IS TABLE OF DATE;
DT_VAR BLK_DT;
t date;
begin
select createdate bulk collect into DT_var from busrep;
< NOW I NEED TO GET MAX() from DT_VAR table
How can I get it ??? >
end;
/
Thankyou
Jr
Printable View
Hi there,
I require help here...
declare
TYPE BLK_dt IS TABLE OF DATE;
DT_VAR BLK_DT;
t date;
begin
select createdate bulk collect into DT_var from busrep;
< NOW I NEED TO GET MAX() from DT_VAR table
How can I get it ??? >
end;
/
Thankyou
Jr
Do this:
declare
TYPE BLK_dt IS TABLE OF DATE;
DT_VAR BLK_DT;
t date;
i pls_integer;
begin
select createdate bulk collect into DT_var from busrep;
t := to_date('01-JAN-1900');
for i in 1..DT_var.count
loop
t := GREATEST(t,DT_VAR(i));
end loop;
end;
/
If you need the index also, then add:
max_i pls_integer;
and replace the 'for' with:
for i in 1..DT_var.count
loop
if DT_VAR(i)) > t then
max_i := i;
t := DT_var;
end if;
end loop;
:cool:
Thanks for the response,
but was wondering if anything possible without LOOP construct.
Jr.