Method which returns the current
time
Class LLT{
public static java.sql.Timestamp
getCLastLoginTime() {
java.util.Date date = new java.util.Date();
return new java.sql.Timestamp(date.getTime());
}
}
Sql Queries
CREATE TABLE date_tab (
ts_col TIMESTAMP);
INSERT INTO date_tab VALUES (
TIMESTAMP'1999-12-01
10:00:00');
SELECT TO_CHAR(ts_col, 'DD-MON-YYYY HH24:MI:SSxFF')
FROM date_tab;
TO_CHAR(TS_COL,'DD-MON-YYYYHH2
------------------------------ -------------------------------------
01-DEC-2011 10:00:00
Insert current login time in oracle through java
String sql =
"insert into date_tab values(TIMESTAMP ‘
"
+LLT.
getCLastLoginTime()+” ‘ “);
PreparedStatement p
stmt
= con.prepareStatement(sql);
No comments:
Post a Comment