I am writing a c++ code in linux using ODBC , I have a table which is having GEN_TIME column of timestamp type, i need 8 data to insert at a time, i defined
array of SQL_TIMESTAMP_STRUCT lDateAndTime[10]; and filled with data like below
const int NUM_ENTRIES = 8;
lDateAndTime[0].year = 2023;
lDateAndTime[0].month = 8;
lDateAndTime[0].day = 10;
lDateAndTime[0].hour = 11;
lDateAndTime[0].minute = 30;
lDateAndTime[0].second = 0;
lDateAndTime[1].year = 2023;
lDateAndTime[1].month = 8;
lDateAndTime[1].day = 10;
lDateAndTime[1].hour = 11;
lDateAndTime[1].minute = 30;
lDateAndTime[1].second = 0;
And i set insert query like below
ret = SQLPrepare (hdlStmt, (SQLTCHAR*)"INSERT INTO test_evr_details (evr_event, evr_reason, evr_cause, TRANS_ID, GEN_TIME) VALUES (?, ?, ?, ?, ?)" , SQL_NTS) ;
and set the date filed like
ret = SQLBindParameter(hdlStmt, 5, SQL_PARAM_INPUT, SQL_C_TIMESTAMP, SQL_TYPE_TIMESTAMP, 0, 0, (SQLPOINTER)lDateAndTime, sizeof(SQL_TIMESTAMP_STRUCT) , NULL);
and i set the number of batch as
ret = SQLSetStmtAttr( hdlStmt, SQL_ATTR_PARAMSET_SIZE,
(SQLPOINTER)NUM_ENTRIES, 0 );
and executed query as
ret = SQLExecute(hdlStmt);
But it is getting error, if i remove GEN_TIME from the query, then it is inserting 8 rows.

