oracle資料庫查詢日期型別字段

2022-08-13 15:09:17 字數 505 閱讀 5869

說明:資料庫的字段為日期型別

操作:

第一種方式將字串日期轉換成date型別,用到函式to_date,方式如下:

select d.s_info_windcode from cbonddescription d where d.is_failure =   0 and 

and opdate = to_date('2018/12/26 11:06:29','yyyy/mm/dd hh24:mi:ss')

第二種方式將字段轉換成字元格式,用到函式to_char,方式如下:

select d.s_info_windcode from cbonddescription d where d.is_failure =   0 and 

and to_char(opdate,'yyyymmdd hh24:mm:ss') = '20181226 11:06:29'

ORACLE資料庫日期型別

sysdate 返回作業系統中的當前日期和時間。current date 會話的時區中的系統日期 systimestamp 報告timestamp資料型別格式的系統日期 add months sysdate,6 新增月份 add months sysdate,6 減少月份 months betwee...

資料庫日期查詢

有表a,日期字段,週期字段 週期欄位為一年,兩年,三年 現要查詢 當前時間是否大於 日期字段 oracle 中執行sql 語句如下 ds cycle 週期字段,為字典值,配置項,值為月份 一年12個月 select from t relay protection t where add months...

Oracle資料庫Date型別查詢問題

oracle資料庫date型別查詢問題 用過oracle資料庫的朋友應該知道,oracle資料庫在以date型別為查詢條件時存在乙個小小的bug,如 select from tablename where createdate to date 2007 01 01 yyyy mm dd and cr...