Author Topic: Date Diff Function Not provided by Oracle- Here is one  (Read 1181 times)

Prakash

  • Newbie
  • *
  • Posts: 13
    • View Profile
Date Diff Function Not provided by Oracle- Here is one
« on: September 25, 2013, 03:49:31 PM »
Code: [Select]
CREATE OR REPLACE FUNCTION datediff (p_d1 IN DATE, p_d2 IN DATE)
   RETURN NUMBER
AS
   l_result   NUMBER;
BEGIN
   SELECT (p_d2 - p_d1) + 1 INTO l_result FROM DUAL;

   RETURN l_result;
END;
« Last Edit: September 25, 2013, 07:01:41 PM by Mike »


Mike

  • Administrator
  • Hero Member
  • *****
  • Posts: 1947
    • View Profile
Re: Date Diff Function Not provided by Oracle- Here is one
« Reply #1 on: September 25, 2013, 07:01:52 PM »
Nice!