Home » SQL & PL/SQL » SQL & PL/SQL » Insert date on a table (Oracle, 10g express, winxp)
icon4.gif  Insert date on a table [message #347774] Sat, 13 September 2008 18:55 Go to next message
juanp.contreras
Messages: 8
Registered: September 2008
Junior Member
Hi...

I'm trying to insert a date in a table with an attribute DATE or TIMESTAMP (I've tried with both datatypes). But, every attempt fails given that the DBMS "cuts" the information and then, it only inserts the date and not the hour, minutes or seconds. Also, Oracle SQLDeveloper only shows the date...

how do I should insert a complete date?
how do I get Oracle SQLDeveloper to show only the time (not the other date data)?

Thanks...
Re: Insert date on a table [message #347780 is a reply to message #347774] Sat, 13 September 2008 22:09 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & FOLLOW the Posting Guidelines as stated in URL above

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions180.htm#sthref2296

Re: Insert date on a table [message #347800 is a reply to message #347774] Sun, 14 September 2008 01:36 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Quote:
But, every attempt fails given that the DBMS "cuts" the information and then, it only inserts the date and not the hour, minutes or seconds.

This is 100% wrong. Oracle always inserts and stores both date and time, it is just that it doesn't always display exactly what you want to see. Read the links that anacedent posted, but don't get confused that he meant for you to use the function whilst inserting, only use it whilst displaying the data.
Re: Insert date on a table [message #347811 is a reply to message #347774] Sun, 14 September 2008 03:17 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

how do I should insert a complete date?
Use Date datatype. and just use normal insert statement.

insert into tab values (SYSDATE);


how do I get Oracle SQLDeveloper to show only the time (not the other date data)?
use DATE/TIME format.

Re: Insert date on a table [message #347839 is a reply to message #347800] Sun, 14 September 2008 09:13 Go to previous messageGo to next message
juanp.contreras
Messages: 8
Registered: September 2008
Junior Member
Thanks!!
Re: Insert date on a table [message #347841 is a reply to message #347780] Sun, 14 September 2008 09:14 Go to previous messageGo to next message
juanp.contreras
Messages: 8
Registered: September 2008
Junior Member
Why did you send me that link?? Have I made something wrong?
Re: Insert date on a table [message #347842 is a reply to message #347811] Sun, 14 September 2008 09:15 Go to previous message
juanp.contreras
Messages: 8
Registered: September 2008
Junior Member
Thanks!!!
Previous Topic: NOT NULL Constraint
Next Topic: Prevent inserts during a process - is locking a feasible option?
Goto Forum:
  


Current Time: Sat Feb 15 00:39:44 CST 2025