select multi_result -1
from
(
select
dbms_aw.eval_number( replace(wmsys.wm_concat(result )over(order by rownum), ',', '*') ) multi_result
from
(select date_ ,
value ,
case
when rownum1 = icount then
4* value
else
1* value
end result
from (select a.date_ , a.value, a.rownum1, b.icount
from (select date_, value , rownum rownum1
from (select date_, value from a2 order by date_ )) a, --确保顺序
(select count(*) icount from a2 order by date_ ) b --确保顺序
)
)
order by rownum desc
)
where rownum < 2
select wmsys.wm_concat(a )over(order by rownum) , replace(wmsys.wm_concat(a )over(order by rownum), ',', '*'),
dbms_aw.eval_number( replace(wmsys.wm_concat(a )over(order by rownum), ',', '*') ) serial_multi
from a2
drop table a2 ;
create table a2 (
date_ date ,
value number
)
select * from a2
for update
select * from a2
order by date_
for update