红色是需要达到的 效果 递减
解决方案 »
- 请教一个异常:ORA-03113: 通信通道的文件结束
- 表数据交换--急!!!!
- oracle用Navicat 连接报12541无监听程序错误
- 我在redhat ES4上安装了 oracle10g 在本机上可以正常使用。从别的及其访问,出现ORA-12560错误
- 如何查ORACLE9I的当前连接数?
- oracle中jdbc怎样写?,是oracle.jdbc.OracleDriver?
- 求一sql语句
- 日期转换,请哪位兄弟帮个忙呀,很郁闷:)
- 各路高手,我想在oracle的表中修改单据号D00000026~D0000798(字符类型)这些记录的的审核日期,有没有比较方便快捷的方法!
- 以下两个SQL哪个效率高一些?
- oracle 客户端安装到arm
- 关于行列转换函数的问题
Table created
SQL> begin
2 insert into test values(1,2380,2000);
3 insert into test values(2,2380,600);
4 insert into test values(3,2380,600);
5 end;
6 /
PL/SQL procedure successfully completed
SQL> select id, num, num2, num - sum(num2) over(order by id) result from test ;
ID NUM NUM2 RESULT
---------- ---------- ---------- ----------
1 2380 2000 380
2 2380 600 -220
3 2380 600 -820
SQL> drop table test purge ;
Table droppedSQL>
select 2380 as c1,2000 as c2 from dual union all
select 2380 as c1,600 as c2 from dual union all
select 2380 as c1,600 as c2 from dual
)
select c1,c2,case when lag(c3)over(order by rn) is null then c3 else lag(c3)over(order by rn)||'-'||c2 end c4
from (select c1,c2,c1||'-'||c2 c3,rownum rn from t)
select 1 id,2380 as c1,2000 as c2 from dual union all
select 2 id,2380 as c1,600 as c2 from dual union all
select 3 id,2380 as c1,600 as c2 from dual
)
select t.*,c1-sum(c2) over(order by id rows between unbounded preceding and current row) ss from t;