User Tools

Site Tools


kurs:datum

This is an old revision of the document!


alter session set NLS_DATE_FORMAT='yyyymidd';

select last_name, hire_date from employees where 
to_char(hire_date, 'yyyymmdd') 
between '19980201' and  '19980701'
/

nachteil JEDE zeile mu� konvertiert werden

select last_name, hire_date from employees where 
hire_date 
between to_date('19980201', 'yyyymmdd') and  to_date('19980701', 'yyyymmdd') 
/
select * from (
select first_name, last_name, hire_date, trunc(months_between( sysdate, hire_date)) asd from employees
)
where asd >=120
order by hire_date

Zahl der Tage pro Monat, ACHTUNG das trunc von last_day liefert Mitternacht des letzen Tages, also dauert der Monat dann noch 24h!

select (trunc(last_day(sysdate))+1 - trunc(sysdate, 'month')) from dual;
select add_months(to_date('20090131', 'yyyymmdd'), 1) from dual;
select to_date('15821004', 'yyyymmdd') + 1 from dual;
kurs/datum.1288251049.txt.gz · Last modified: 2014/09/10 21:22 (external edit)