>Hi,
>
>how do i round dates like this:
>Date = 01-01-1996 
>Return = 01-01-2000
>
>or 
>
>Date = 01-01-1992
>Return  = 01-01-1990
>
>
>Thanks.
>

create or replace function decade_round(p_date in date)
return date
is
  d_result     date;
begin
  d_result := to_date('01/01'||ltrim(round(to_number(to_char(p_date,
                        'YYYY')),-1)), 'DD/MM/YYYY');
  return d_result;
end;
/

Regards,

Stephane Faroult
Oriole
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroul
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to