3 Replies Latest reply: Feb 20, 2013 10:22 PM by Xandot RSS

    Sql ---sum of Date-time formate ......

    Xandot
      -----------------------------
      id time
      ---------------------
      1 1.20
      2 2.30
      3 4.20
      4 5.30
      5 1.00

      result expected = 14:40 or (if AM/PM so result is ???)
      how can i calculate the sum of time ???
      please give me some fast tricks of handling date/time formate in oracle....
        • 1. Re: Sql ---sum of Date-time formate ......
          dhalek
          Hello,
          you are posting into the wrong forum as this one is only for questions on Oracle's SQL Developer tool.
          Having said that, you could have a look at the function NUMTODSINTERVAL. This gives you date time intervals from of numbers, which in turn can be formatted with TO_CHAR.

          Hope that helps,
          dhalek
          • 2. Re: Sql ---sum of Date-time formate ......
            HamidHelal
            942425 wrote:
            -----------------------------
            id time
            ---------------------
            1 1.20
            2 2.30
            3 4.20
            4 5.30
            5 1.00

            result expected = 14:40 or (if AM/PM so result is ???)
            how can i calculate the sum of time ???
            please give me some fast tricks of handling date/time formate in oracle....
            Hi,
            First you post in wrong forum. Please post at PL/SQL

            Before posting there close it and mark as answered.

            if your time is number data type then you can try this
            SELECT SUM(NVL(ROUND(TRUNC(DAC_OT_HOUR)+((TO_NUMBER (SUBSTR (DAC_OT_HOUR, INSTR (DAC_OT_HOUR,'.',1,1)+1)))/60)),0)) 
            FROM DA_CHECK
            Hope this helps


            Hamid

            Mark correct/helpful to help others to get right answer(s).*
            • 3. Re: Sql ---sum of Date-time formate ......
              Xandot
              sorry for posting in wrong forum....thanks for correct me !!!!