Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Subtracting min(date) from date column
Create a DB function to get the minimum date and include the function in
your SELECT-statement
CREATE OR REPLACE FUNCTION get_minimum_date
RETURN DATE IS
min_date date;
BEGIN
SELECT min (entry_datetime)
INTO min_date
FROM mytable;
RETURN min_date;
END;
/
SELECT entry_datetime - get_minimum_date FROM mytable;
Roland Cont
--
Have a nice day!
![]() |
![]() |