Oracle Date data type insert and format
- From: "teser3@xxxxxxxxxxx" <teser3@xxxxxxxxxxx>
- Date: Mon, 19 Nov 2007 16:24:16 -0800 (PST)
I have a Date insert that is formatted into an Oracle 9i database and
it works.
But I had to make the Date variable a varchar2 in Oracle to get it to
work:
......
java.sql.Timestamp myd = new java.sql.Timestamp(new
java.util.Date().getTime());
String sub_date = new SimpleDateFormat("mm/dd/yy , h:mm
a").format(myd);
String query = "insert into dept(location, sub_date) values(?, ?)";
PreparedStatement pstmt =
conn.prepareStatement(query);
pstmt.setString(1, "Jersey");
pstmt.setString(2, sub_date);
pstmt.executeUpdate();
.......
I also tried pstmt.setDate(2, sub_date) with a Date data type in
Oracle and I could get the date to insert but couldnt format it.
Please advise how I can get the Oracle Date datatype to work where I
can also format it?
.
- Follow-Ups:
- Re: Oracle Date data type insert and format
- From: teser3@xxxxxxxxxxx
- Re: Oracle Date data type insert and format
- Prev by Date: Re: Evaluating Business Intelligence Options for Software developers
- Next by Date: Re: Oracle Date data type insert and format
- Previous by thread: Evaluating Business Intelligence Options for Software developers
- Next by thread: Re: Oracle Date data type insert and format
- Index(es):
Relevant Pages
|
|