Help-calculate hours

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Mon, 20 Mar 2006 3:46 pm

I need to calculate the number of hours between two dates, where the smaller date has to be from a fixed schedule the 05:00 in the morning.
for example: select (DataHora_Atual-(Datetime 05:00)) from dual how do I?

Thanks Marlon
Marlon Pasquali
Location: Erechim - RS

Poston Mon, 20 Mar 2006 5:05 pm

Can do so:
Code: Select all
SQL> select
  2   sysdate -
  3   ( trunc(sysdate) + 1/24 * 05 ) --> este 5 é 5am.
  4    QTD_DE_DIAS
  5  from dual
  6  /

QTD_DE_DIAS
-----------
.503449074

SQL>
SQL>
SQL> select
  2    (
  3    sysdate-
  4    (trunc(sysdate) + 1/24 * 05 )--> este 5 é 5am.
  5    ) * 24
  6    QTD_DE_HORAS
  7  from dual
  8  /

QTD_DE_HORAS
------------
      12.085

SQL>
:-
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


  • See also
    Replies
    Views
    Last Post


      Return to SQL

      Who is online

      Users browsing this forum: No registered users and 4 guests