This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Insert a date of type timestamp into oracle. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Insert a date of type timestamp into oracle. " Watch "Insert a date of type timestamp into oracle. " New topic
Author

Insert a date of type timestamp into oracle.

pavani potnuru
Greenhorn

Joined: Nov 04, 2007
Posts: 11
I have to retrieve the records in a chronological order.So I need to insert the records using time stamp so that i can compare them and retrieve.
I need the syntax of the insert statement.Please help me out in this....
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
insert into your_table(your_column) values (SYSTIMESTAMP);

Alternately you can use the to_date function to format a Date String of your own for inserting in the data base.. substitute it in place of systimestamp

insert into your_table(your_column) values (to_date(yourString, 'mm/dd/yyyy hh24:mi:ss'))
[ December 12, 2007: Message edited by: Paul Campbell ]
 
Don't get me started about those stupid light bulbs.
 
subject: Insert a date of type timestamp into oracle.