I have this table in SQL Oracle database
MESSAGES
--------
Name Null? Type
-------------- -------- --------------
ID_MESSAGE NOT NULL NUMBER(38)
CONTENT NOT NULL NVARCHAR2(500)
TIME_STAMP NOT NULL TIMESTAMP(6)
And I'm trying to insert a data into this table but I'm having a problem with inserting a timestamp.
I've generated a timestamp in Java and executed the following query:
Timestamp timeStamp = new Timestamp(System.currentTimeMillis());
String query = "INSERT INTO messages(content, time_stamp) VALUES ('"+textAreaSendMessage.getText()+"', "+timeStamp+")";
st.executeQuery(query);
And I'm getting this error:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00917: missing comma
How to fix this so it inserts timestamp into a database?
