Oracle数据库操作

  • Oracle获取各个时间点:
SELECT TRUNC(LAST_DAY(SYSDATE)+1+8/24) + 9 / 24 + 0 / 24 / 60 + 0 / 24 / 60 / 60 FROM DUAL

SELECT TRUNC(SYSDATE)+0/24 FROM DUAL;     --当天0点

SELECT TRUNC(SYSDATE)+9.5/24 FROM DUAL;  --当天9点半

SELECT TRUNC(SYSDATE)+12/24 FROM DUAL;   --当天中午12点    
  •  Oracle拆分逗号隔开列为多行
1 SELECT CK_PERSON FROM 
2  (SELECT REGEXP_SUBSTR(字段, '[^,]+', 1,LEVEL) 字段
3     FROM (SELECT * FROM 表名 WHERE CK_FLAG=0 AND
4       CREATETIME=(select trunc(sysdate, 'mm') from dual))
5       CONNECT BY LEVEL <= REGEXP_COUNT(字段, '[^,]+')
6       AND ROWID = PRIOR ROWID
7       AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL
8    ORDER BY 字段)
9 GROUP BY 字段;

 

你可能感兴趣的:(Oracle数据库操作)