Re: New to SQL Analytics and need help
From: Pratap <pratap_fin_at_rediffmail.com>
Date: 24 Sep 2004 02:42:36 -0700
Message-ID: <830861d2.0409240142.76cb6f9e_at_posting.google.com>
Date: 24 Sep 2004 02:42:36 -0700
Message-ID: <830861d2.0409240142.76cb6f9e_at_posting.google.com>
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 - 11:42:36 CEST