I am trying to insert into a new Database named XpressMP
. And I need to insert a timestamp value in that database. Also it doesn't supports TO_TIMESTAMP
instead of that, it supports CURRENT_TIMESTAMP
which takes no parameter and it gives the current timestamp value.
So in the below SQL, second column and third column data types are Timestamp and total number of columns are 30. So I was thinking to use preparedStatement here to insert the record. And in the below SQL, I have placed CURRENT_TIMESTAMP
in second column and third column to get the current timestamp and in the prepared statement I am leaving column for 2 and 3. But after running it gives me exception as
java.sql.SQLException: Driver Error: index parameter to bindParam() must be between 1 and numParameters.
Below is the code, I am using.
private static String insertSQL = "INSERT INTO USER"
+ "("
+ "ID, CREATION_DATE, LAST_MODIFIED_DATE) VALUES"
+ "(?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)";
preparedStatement.setString(1, "1000015236");
preparedStatement.setString(4, "Hello");
Can anyone help me what wrong I am doing here?