| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: New to SQL Analytics and need help
You have to lead LAG instead of LEAD
To update, if you have few rows then this will work fine -
begin
for rec in
(
select lead(old_loc) over (partition by id order by operation_dt)
a, rowid rid
from tab_name
)
loop
update tab_name set new_loc = rec.a where rowid = rid
end loop;
end;
But if you have too many rows and performance is an issue then use merge command as given here -
Regards,
Pratap Received on Fri Sep 24 2004 - 04:42:36 CDT
![]() |
![]() |