Oracle獲取毫秒和年月日到毫秒方法

2021-06-08 06:19:18 字數 789 閱讀 3313

select to_char((sysdate - to_date('1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') - (1 / 3)) * 8640000, '999999999999999') from dual;

select (to_char(systimestamp, 'yyyymmddhh24missff2 ')) from dual;

1.查詢當前月資料

select * from xpmt_coupon  x where  to_char(sysdate, 'yyyy-mm' )!=to_char(x.created_date,'yyyy-mm');

2.查詢上乙個月的資料

select * from xpmt_coupon  x where to_char(add_months(trunc(sysdate),-2),'yyyy-mm')=to_char(x.created_date,'yyyy-mm');

3.判斷字段是否為數字,如果是則是true,如果不是則是false

select * from xprd_brand x where regexp_like(x.initial_info,'^[[:digit:]]+$') order by x.initial_info;

4.數字加字元欄位的排序方式

select * from xprd_brand x  order by regexp_replace(regexp_replace(x.initial_info,'(\d)([a-z])(\d)','0\1\20\3'),'0(\d)','\1')

獲取年月日

需求 獲取當前日期的前乙個月份 當月有 31 天時,js 日期物件 setmonth 問題 當前日期如果不是 31 號,是沒問題的,是 31 號就會有問題 比如今天是 2018 09 30 號,前乙個月應該是 2018 08 30 let now new date new date 2018 09 ...

Oracle 獲取當前年 月 日

oracle 獲取當前年 月 日 1 oracle中extract 函式從oracle 9i中引入,用於從乙個date或者interval型別中擷取到特定的部分 語法如下 extract from selectextract yearfromsysdate fromdual 當前年 selectex...

Oracle 獲取當前年 月 日

size large oracle 獲取當前年 月 日 第一種 new timestamp system.currenttimemillis 第二種 sysdate 1 oracle中extract 函式從oracle 9i中引入,用於從乙個date或者interval型別中擷取到特定的部分 語法如...