insert time

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
omaisnormalbaba
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Tue, 26 Jun 2007 9:20 am
Location: Passos - MG
Hello World

Good morning ... I'm new to the forum and also in Oracle ... first I would like to congratulate you for the forum .. it is very good ... I would like the help of you ...
I have a table that You need to store only the schedules of my application. I'm going to insert only team ... I'vê tried coverer but not right ..
Ex:

Select all

 
insert into raca values (4,1,'Rot','Grande',to_date('01:00:00', 'hh24:mi:ss')).. 
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

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

If the field of your table is date, you have to put a date with that hour.
No matter what it is, for what matters to you is the time.

The way you did, it will only work if the field is Varchar2.
: -O
omaisnormalbaba
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Tue, 26 Jun 2007 9:20 am
Location: Passos - MG
Hello World

DR_Gori ..

My field is date ... but if I do this:

Select all

 
insert into raca values (5,1,'podle','pequeno',to_date('01/01/2007 00:30:00','dd/mm/yyyy hh24:mi:ss'),to_date('01/01/2007 01:30:00', 'dd/mm/yyyy hh24:mi:ss')) 
in the bank of Data is stored complete, with dates and hours ..
I put the call:

Select all

 
select * from raca; 
 
returned:
1-Jan-2007 0: 30:00 ....

did not return the time ....

What am I doing wrong?
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

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

Yes, the Date field saves the date as well.
But as you want only minutes, do so with your SELECT:

Select all

select to_char( campo , 'hh24:mi:ss') hora 
from raca; 
look only for the time.

But why do you just want the time? What is the use of keeping only the time and not the date?
omaisnormalbaba
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Tue, 26 Jun 2007 9:20 am
Location: Passos - MG
Hello World

Thanks..
rob.rodrigues
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Tue, 09 Oct 2007 7:50 am
Location: São Paulo - SP

Good morning,

I'm new here and beginner in Oracle too, and I have a similar problem.

I have to fill some date fields only with minutes and seconds.

Reason: These fields will measure the preparation time of a dish, and the time of delivery (this is fixed in 20 minutes)

I tried to preenher the field with the following insert:

Select all

 
INSERT INTO BAIRRO ( CDBAIRRO, NMBAIRRO, TEMPENTREGA) 
             VALUES ( 01, 'Aclimação', to_date('20:00', 'mi:ss')); 
He ran normal and accepted the data, however, applying the SELECT

Select all

 
 select * from bairro 
The result was as follows:

Select all

 
CDBAIRRO               NMBAIRRO             TEMPENTREGA                
---------------------- -------------------- -------------------------  
1                      Aclimação            01/10/07                   
 
1 rows selected 
would have some way I can fill this field only with the minutes, because In the future, I will have to use a function to add the values ??and display on the user (a kind of monitoring), the estimated deadline for delivery of the product.

PS. Sorry for reviving the topic, but is that the theme is similar and thanks for the patience
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

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

SQL does not show the time.
You will be able to look at the value of minutes if you use a to_char, and informing the mask.

Select all

select to_char(TEMPENTREGA, 'hh24:mi') hora from ... 
rob.rodrigues
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Tue, 09 Oct 2007 7:50 am
Location: São Paulo - SP

Thank you so much Dr_Gori.

That's exactly what I needed to be able to proceed with my work.

Filling the data is right, now I will only have to create a Function to add the delivery times with the longest time of preparation of the dishes, and add the time of the customer's request (which will be defined by the system).

Thank you very much.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests