+ 2
How can we insert current date in oracle (data type of colum is Date) by using java Language?
I tried sysdate but it is not working
5 Answers
+ 2
SYSDATE should work.
You can build any date like this in Oracle database :
TO_DATE('2019-11-05', 'YYYY-MM-DD')
what is your insert sql statement that is failing?
+ 2
sysdate is an sql keyword. It doesn't exist in Java. So you just put it in the raw sql text and don't substitute with ?
sql = "insert into sam.test values(sysdate)" ;
+ 2
Tibor Santa thank u so much it execute đ
+ 1
Tibor Santa
sql ="insert into sam.test value s(?);
pst=(oracle prepared statement)conn.preparestatement(sql);
pst.setDate(1,sysdate);
sysdate is showing error as:can't find symbol
+ 1
i want automatic time insertion that's why I can't use other method