sql >> Base de Datos >  >> RDS >> Oracle

Convertir VARCHAR2 en Número

Puedes separar las horas, minutos y segundos usando SUBSTR , luego SUM arriba y finalmente usa NUMTODSINTERVAL función para convertirlo en INTERVAL tipo.

SELECT NUMTODSINTERVAL (SUM (total_secs), 'second')
  FROM (SELECT   SUBSTR (duration, 1, 2) * 3600
               + SUBSTR (duration, 4, 2) * 60
               + SUBSTR (duration, 7, 2) total_secs
          FROM user_tab);