How can Insert Time Value alone into Date field ? [message #371001] |
Thu, 03 August 2000 23:25 |
Suresh.N
Messages: 41 Registered: March 2000
|
Member |
|
|
Hi!
I have one Table Called Test
CREATE TABLE TEST (Date_Field Date,Time_Field Date);
I would like to Insert the Valued Date in Date field and Time Value alone in Time Filed.
But I could not insert time value alone into Time Filed.
Is it is possible or not ?
Otherwise should I use Varchar Datatype for to Store Time Value.
Thanks
Suresh
|
|
|
Re: How can Insert Time Value alone into Date field ? [message #371004 is a reply to message #371001] |
Fri, 04 August 2000 11:23 |
Geraldo Viana de Paula Ju
Messages: 8 Registered: August 2000
|
Junior Member |
|
|
Oracle Date Datatype works with dates and times together. I thing this is particularly a great feature. You cannot assign just a time to a column date ! Oracle implicity assign a date to it. So, why would you separate them ?. I suggest that you always works with date datatype even for times, or just a few of seconds to hold. Test this: "insert into table_name(column_date_datatype) values(sysdate);". After this: "select to_char(column_date_datatype,'dd/mm/yyyy hh24:mi:ss') from table_name". You will get the current system date and time when you commited the statement.
|
|
|
Re: How can Insert Time Value alone into Date field ? [message #371005 is a reply to message #371004] |
Fri, 04 August 2000 11:50 |
Suresh.N
Messages: 41 Registered: March 2000
|
Member |
|
|
Hi!
Thanks for Reply.
I know i can insert time values in DATE type.
But the requiremnet is I have to store time value alone. I tried to store time value. If it is sysdate it allows to to enter, If i give some other time it does't not allow.
I thing i have to go for varchar field to store time value with p.M or a.m.
Thnaks again.
Suresh
|
|
|
Re: How can Insert Time Value alone into Date field ? [message #371006 is a reply to message #371005] |
Fri, 04 August 2000 12:51 |
Geraldo Viana de Paula Ju
Messages: 8 Registered: August 2000
|
Junior Member |
|
|
Look at this: "insert into table_name(column_date_datatype) values(to_date('15:22:31','hh24:mi:ss'));". Like this you can insert any time you want in a column date. I enforce that you use date datatype instead varchar2, it will let you reduce the amount of code to performe calculations. In a input form you can set the mask format in a datetime item in the same way.
|
|
|