1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Function to convert days into hours

Discussion in 'Oracle Apps Technical' started by nilesh.dudhane, Aug 24, 2015.

  1. nilesh.dudhane

    nilesh.dudhane Active Member

    Messages:
    42
    Likes Received:
    2
    Trophy Points:
    135
    Location:
    India
    This function helps to convert No of Days into Hours.

    Code (SQL):
    CREATE OR REPLACE FUNCTION XX_DAY_TO_HR (p_days NUMBER)
       RETURN VARCHAR2
    IS
       l_string   VARCHAR2 (50);
       l_test     NUMBER;
    BEGIN
       l_test := p_days;
       l_string := TRUNC (l_test) || ' ';
       l_test := 24 * (l_test - TRUNC (l_test));
       l_string := l_string || TRUNC (l_test) || ':';
       l_test := 60 * (l_test - TRUNC (l_test));
       l_string := l_string || TRUNC (l_test) || ':';
       l_test := 60 * (l_test - TRUNC (l_test));
       l_string := l_string || ROUND (l_test);
       RETURN l_string;
    END;
    Thanks
    Nilesh