-2

I'm trying to insert a date in SQLite database, can anyone help me with the query this is my query:

ResultSet rs = stmt.executeQuery( "INSERT INTO date VALUES (10/10/2020)");

an this is the error that i'm having :

org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "30": syntax error)

Ousmane D.
  • 54,915
  • 8
  • 91
  • 126
mohamed
  • 11
  • 1
  • 7

1 Answers1

0

"INSERT INTO date VALUES (2020-10-10)" will insert 2000, as you reported, because 2020-10-10 = 2010-10 = 2000 (this is an integer evaluation). If you want a string, then specify it - "INSERT INTO date VALUES ('2020-10-10')"

varro
  • 2,382
  • 2
  • 16
  • 24