create or replace function dateToNumber(i_date in date) return number is result number ; begin result := TO_NUMBER(NVL(TO_CHAR(i_date, 'J'), '0')); return result; end dateToNumber;