Subtract time

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

Poston Mon, 31 Jul 2006 3:09 pm

Guys use the oracle 8i and have the following select: [code:31bholoy]
SELECT to_char(dat_abertura,'HH24:MI:SS')ABERTURA,
To_char(DAT_FECHAMENTO, 'HH24:MI:SS')FECHAMENTO
FROM CHM_CADASTRO WHERE STA_CHAMADO = 'Fechado'
[/code:31bholoy] I would like to know how to subtract the dat_abertura and the dat_fechamento?
Thanks
rcampaneli
Location: PR

Poston Mon, 31 Jul 2006 3:26 pm

Dude, take a look at this topic: \"calculation of hours between two dates/hours\" There has the solution you seek.
erthal
Location: Niterói - RJ

Poston Mon, 31 Jul 2006 3:32 pm

I did this following select SELECT (dat_fechamento-dat_abertura) the Data from CHM_CADASTRO WHERE STA_CHAMADO = ' Closed ' is there any way to bring him with time format?
rcampaneli
Location: PR

Poston Mon, 31 Jul 2006 3:47 pm

the two fields are in the farmato date
rcampaneli
Location: PR

Poston Mon, 31 Jul 2006 3:50 pm

Pass the to_date (, ' hh24: mi: ss ')
erthal
Location: Niterói - RJ

Poston Mon, 31 Jul 2006 3:53 pm

I wonder if you could show me how it's done, I can't do.
Thanks
rcampaneli
Location: PR

Poston Mon, 31 Jul 2006 5:12 pm

SELECT (to_date (dat_fechamento, ' DD/MM/RRRR HH24: MI: SS ')-to_date (dat_abertura, ' DD/MM/RRRR HH24: MI: SS ')) * 12:0 am the Data from CHM_CADASTRO WHERE STA_CHAMADO = ' Closed '
Marlon Pasquali
Location: Erechim - RS

Poston Mon, 31 Jul 2006 5:16 pm

He brought the result with 0 value.
rcampaneli
Location: PR

Poston Mon, 31 Jul 2006 5:24 pm

is that the result certainly is giving less than 1:0. Below is the most comprehensive example.

select trunc (((dat_fechamento-dat_abertura) * 86400/3600)) || ': ' ||
trunc (mod ((dat_fechamento-dat_abertura) * 86400, 3600)/60) || ':'||
trunc (mod (mod ((dat_fechamento-dat_abertura) * 86400, 3600), 60)) While the Data from CHM_CADASTRO WHERE STA_CHAMADO = ' Closed '
Marlon Pasquali
Location: Erechim - RS

Poston Mon, 31 Jul 2006 5:26 pm

Man that's really ... thank you all so much for the tips.

Thanks
rcampaneli
Location: PR

Poston Wed, 24 Oct 2018 3:05 pm

Topic under translation. Come back later. (This is an automatic message)
FMMS


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: Google [Bot] and 4 guests