设置oracle中date的会话格式为 ‘yyyy-mm-dd hh24:mi:ss‘
alter session set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘;
设置oracle中timestamp的会话格式为 ‘yyyy-mm-dd hh24.mi.ss.ff’
alter session set nls_timestamp_format=‘yyyy-mm-dd hh24.mi.ss.ff‘;
c#中向oracle中插入date 可以直接操作日期数据:
SELECT * FROM T_TABLE WHERE createDate Between ‘2015-09-15‘ AND ‘2015-09-25‘
c#中向oracle中操作timestamp 必须间接的转timestamp 进行操作:
SELECT * FROM T_TABLE WHERE createDate Between TO_TIMESTAMP(‘2015-09-15‘,‘yyyy-mm-dd hh24:mi:ss‘) AND TO_TIMESTAMP(‘2015-09-25‘,‘yyyy-mm-dd hh24:mi:ss‘)
/或者:
SELECT * FROM T_TABLE WHERE createDate Between TO_TIMESTAMP_TZ(‘2013-12-09‘,‘YYYY-MM-DD HH24:MI:SS.FF TZH:TZM‘) AND TO_TIMESTAMP_TZ(‘2015-12-09‘,‘YYYY-MM-DD HH24:MI:SS.FF TZH:TZM‘)
时间: 2024-10-10 13:54:32