oracle数据库里面的字符串转成数字类型,答:insert into a values (3,'cc');cimmit;取当前行的前一行数据 select id,name,lag(id,1)over(order by id),lag(name,1)over(order by id) from a where id in (2,3);取当前行的后一行数据 select id,name,lead(id,1)over(order by id),lead(name,1)over(order by id) from a...
oracle-sql如何查出:一段时间内(输入时间区间),某数据,连续7天内出现...答:(select a.人名,a.日期,lead(a.日期,4,null)over(partition by 人名 order by q.日期) 五次后的日期 from (select 人名,trunc(时间,'dd')日期 from table geoup by 人名,trunc(时间,'dd')) a ) b where b. 五次后的日期-b.日期<=6 大概就是这么个意思。第二步select查出来的...
ORACLE将连续或不连续月份合并sql怎么写,要求不通过存储过程实现_百度...答:ALLSELECT 'B', '2018-05' FROM dual)SELECT col1,to_char(wm_concat(cat)) FROM (SELECT DISTINCT col1,MIN(col2)OVER(PARTITION BY col1,flg1)||'至'||Max(col2)OVER(PARTITION BY col1,flg1) catFROM(SELECT COL1,COL2,CASE WHEN SUBSTR(COL2,6) - LAG(SUBSTR(COL2,6)...