Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re:help needed in data datatype
Harvinder,
If you want time in a date column, you've got to tell Oracle what to put in there, otherwise it assumes 00:00:00. In your statement there is no time therefore none got recorded. So what you need is:
insert into dd
values(to_date('04-JUL-01 23:59:59','DD-MON-YY HH24:MI:SS');
Another way to look at it is to try:
select to_char(to_date('01-JUL-01'),'DD-MON-YY HH24:MI:SS') from dual;
Dick Goulet
____________________Reply Separator____________________ Author: Harvinder Singh <Harvinder.Singh_at_MetraTech.com> Date: 7/3/2001 1:13 PM
Hi,
I have a table with colum defined as date datatype ..for example
create table dd(dd date);
when we insert into this table like :
insert into dd values('04-jul-01');
when we do select as:
select to_char(dd,'DD-MON-YYYY HH24:MI:SS') from dd;
the result displayed is :
TO_CHAR(DD,'DD-MON-Y
04-JUL-2002 00:00:00 our application requires time to store as 23:59:59 and not as 00:00:00(midnight)....
How can i make a check or apply some rule that whenever someone inserts into
this column time always added as 23:59:59........
Thanks
Harvinder
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.2919.6307" name=GENERATOR></HEAD>
<BODY>
<P><FONT size=2>Hi,</FONT></P>
<P><FONT size=2>I have a table with colum defined as date<SPAN
class=671200920-03072001><FONT color=#0000ff face=Arial><FONT color=#000000
face="Times New Roman"> datatype</FONT> </FONT></SPAN>..for
example</FONT></P>
<P><FONT size=2>create table dd(dd date);</FONT></P>
<P><FONT size=2>when we insert into this table like :</FONT></P>
<P><FONT size=2>insert into dd values('04-jul-01');</FONT></P>
<P><FONT size=2>when we do select as:</FONT></P>
<P><FONT size=2>select to_char(dd,'DD-MON-YYYY HH24:MI:SS') from dd;</FONT></P>
<P><FONT size=2>the result displayed is :</FONT></P>
<P><FONT size=2>TO_CHAR(DD,'DD-MON-Y</FONT></P>
<P><FONT size=2>--------------------------------------</FONT></P>
<P><FONT size=2>04-JUL-2002 00:00:00</FONT></P>
<P><FONT size=2>our application requires time to store as 23:59:59 and not as
00:00:00(midnight)....</FONT></P>
<P><FONT size=2>How can i make a check or apply some rule that whenever someone
inserts into</FONT></P>
<P><FONT size=2>this column time always added as 23:59:59........</FONT></P>
<P><FONT size=2>Thanks</FONT></P>
<P><FONT size=2>Harvinder</FONT></P></BODY></HTML>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: dgoulet_at_vicr.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Jul 03 2001 - 15:42:33 CDT
![]() |
![]() |