insert time

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

Poston Tue, 26 Jun 2007 9:55 am

Good morning... Am new to the forum and also in oracle ... First I would like to congratulate you guys on the forum .. He is very good ...I would like the help of vocês ...
I have a table that needs to store only the schedules of my application. I will only insert team ... I'vê tried to convert but not of right..
Ex:
Code: Select all
insert into raca values (4,1,'Rot','Grande',to_date('01:00:00', 'hh24:mi:ss'))..
omaisnormalbaba
Location: Passos - MG

Hello World

Poston Tue, 26 Jun 2007 11:01 am

The field in your table's DATE, you have to put a date on that time.
No matter what, because what matters to you is the time.

The way you did, will only work, if the field is VARCHAR2.
:-o
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

Poston Tue, 26 Jun 2007 11:47 am

dr_gori..

My field is Date.But if I do this:
Code: 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 database is stored complete with dates and times.
I put the call:
Code: Select all
select * from raca;

returned: January 1, 2007 00:30 ...

not returned only the time ....

What I am doing wrong?
omaisnormalbaba
Location: Passos - MG

Hello World

Poston Tue, 26 Jun 2007 1:11 pm

Yes, the DATE field saves the date too.
But how do you want just the minutes, do so with your select:
Code: Select all
select to_char( campo , 'hh24:mi:ss') hora
from raca;
Seek only the time.

But why would you want to only the time? What's the use of keeping only the time and not the date?
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

Poston Tue, 26 Jun 2007 1:17 pm

Thanks A.. Thank you..
omaisnormalbaba
Location: Passos - MG

Hello World

Poston Tue, 09 Oct 2007 7:59 am

Good morning everybody, I'm new here and new to ORACLE too, and I have a similar problem.

I have to fill out some fields DATE only with the minutes and seconds.

Reason: these fields will measure the time of preparation of a dish, and the time of delivery (this is fixed in 20 minutes) I tried preenher the field with the following insert:
Code: Select all
INSERT INTO BAIRRO ( CDBAIRRO, NMBAIRRO, TEMPENTREGA)
             VALUES ( 01, 'Aclimação', to_date('20:00', 'mi:ss'));
it ran normal and accepted the data, yet apply the select
Code: Select all
select * from bairro
the result was as follows:
Code: Select all
CDBAIRRO               NMBAIRRO             TEMPENTREGA               
---------------------- -------------------- -------------------------
1                      Aclimação            01/10/07                 

1 rows selected
would have any way I can fill this field only with the minutesbecause in the future, I will have to use a function to sum the values and show on screen the user (a kind of monitoring), the estimated time for delivery of the product.

PS. sorry for reviving the topic, but the theme is similar, and thanks for your patience
rob.rodrigues
Location: São Paulo - SP

Poston Tue, 09 Oct 2007 9:15 am

SQL does not show the time.
You can check the value of minutes if using a TO_CHAR, and informing the mask.

Code: Select all
select to_char(TEMPENTREGA, 'hh24:mi') hora from ...
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

Poston Tue, 09 Oct 2007 10:16 am

Thank you very much dr_gori.

It was exactly what I needed to be able to proceed with my work.

Filling the data is right, now just have to create a function to sum the delivery times with longer preparation of dishes, and append the time customer request (which will be defined by the system).

Thank you so much.
rob.rodrigues
Location: São Paulo - SP


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests