ORACLE 统计正负个数sql
select ss.*,
sum(ss.aa) over (partition by ss.zsid order by ss.zsid) as fu,
sum(ss.bb) over (partition by ss.zsid order by ss.zsid) as zheng
from
(
select m.zsid,
sum(n.f0004_028n) over(partition by m.zsid) n011,
sum(n.f0004_029n) over(partition by m.zsid) n012,
sum(n.f0004_030n) over(partition by m.zsid) n013,
sum(n.f0004_031n) over(partition by m.zsid) n014,
sum(n.f0004_032n) over(partition by m.zsid) n015,
sum(n.f0004_033n) over(partition by m.zsid) n021,
sum(n.f0004_034n) over(partition by m.zsid) n022,
sum(n.f0004_035n) over(partition by m.zsid) n023,
n.f0004_017n,
(case when n.f0004_017n>0 then 1 when n.f0004_017n<=0 then 0 end) aa,
(case when n.f0004_017n<=0 then 1 when n.f0004_017n>0 then 0 end) bb
from (select a.f0055_001n zsid,
a.f0055_004v zsbm,
b.f0056_003v code,
b.f0056_004v zsjycs, --指数交易场所
b.f0056_005v zszqlb, --指数证券类别
c.f0005_005v codezqlb, --成份股证券类别
c.f0005_007v codejycs --成份股交易场所
 
相关文档:
oracle实现汉字按照拼音、笔画和部首排序
找了相关的一些资料,都说的不是很清楚,自己也研究了下,终于搞明白了,希望对大家有帮助。
需要说明的是下面的方法需要ORACLE9i和以上的版本才支持。
Oracle9i之前,中文是按照二进制编码进行排序的。
在oracle9i中新增了按照拼音、部首、笔画排序功能。设置NLS_SORT值
......
oracle wait event:cursor: pin S wait on X
cursor: pin S wait on X等待事件的处理过程
http://database.ctocio.com.cn/tips/114/8263614_1.shtml
cursor: pin S wait on X等待!
http://www.itpub.net/viewthread.php?tid=1003340
解决cursor: pin S wait on X 有什么好办法:
http://www.itpub.net/thread-1163543 ......
语法:
substr( string, start_position, [ length ] )
取子字符串,从start_position开始,取length个,length为可选,如果length为空则返回start_position后的所有字符。
实例:
substr('This is a test', 6, 2) would return 'is'
&nbs ......
lengthb(string)计算string所占的字节长度 :返回字符串的长度,单位是字节
length(string)计算string所占的字符长度 :返回字符串的长度,单位是字符
对于单字节字符,LENGTHB和LENGTH是一样的.
如可以用length(‘string’)=lengthb(‘string’)判断字符串是否含有中文。
select lengt ......