How can I make a select showing the data in the format of
time 13:30?
As you already own the values existing in the bank and guarantor that they are only 4 numeric digits in the format of hh:mm
and just want to return them with the time separator :
, you can realize the query down below:
SELECT SUBSTR(ENTRADA, 0, 2) || ':' || SUBSTR(ENTRADA, 3, 2) AS ENTRADA,
SUBSTR(SAIDA, 0, 2) || ':' || SUBSTR(SAIDA, 3, 2) AS SAIDA
FROM sua_tabela
- The command
SUBSTR(entrada, posicaoo, [tamanho_entrada])
, which returns us a slice of the input parameter, in this case the first 2 digits.
- The command
||
is responsible for concatenating strings in Oracle, but you can also use CONCAT.
Although it solves your problem, I advise working with data_type DATE
since its goal is to work with the point control of your company, so it would be a safer and more complete way to work the points of your employees.
Work with date and time on oracle is easy and you can find several examples on the internet.
select substr( input, 1,2 ) || ':' || substr( input, 3,2 ) from table
– Reginaldo Rigo