A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
inserting a string containing date into oracle table which has the date type field
Joined: Dec 05, 2004
Dec 05, 2004 08:49:00
i have a html page which accepts the date from text box in dd/mm/yyyy format.
is stored in string variable in next
now how can i store this string variable into oracle table which has coloumn with date data type.
author & internet detective
Joined: May 26, 2003
Dec 05, 2004 17:43:00
Welcome to JavaRanch!
Take a look at the
class. This converts your String into a Date. Then you can use stmt.setDate() and let Oracle worry about the database format.
OCA 8 book
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
Joined: Aug 13, 2004
Dec 06, 2004 00:41:00
You can do it in either way either convery string into Date typoe in
Code or Do it in Oracle.
To do same in oracle,simply you can use to_date function of oracle to covert your string into date type
Syntax is to_date(String,Format)
if you want to insert a date ie 06/12/2004 in dd/mm/yyyy format,
You can do same like this
insert into table_name(Date_column) values(to_date('06/12/2004','dd/mm/yyyy'))
[ December 06, 2004: Message edited by: Shailesh Chandra ]
Gravitation cannot be held responsible for people falling in love ~
I agree. Here's the link:
subject: inserting a string containing date into oracle table which has the date type field
Passing date and time using Timestamp.
Date Conversion in SQL
parsing in servlet
java.sql.Timestamp to Oracle date
SQL to retrieve date vals from ORA-DB
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015