How to use Database.executePreparedStmtByParamList() to execute a PreparedStatement?
The Database.executePreparedStmtByParamList() method executes a PreparedStatement. A prepared statement is a SQL statement where values are determined at runtime. In this case, the values to be used are passed as a List of parameters.
Signature:
int executePreparedStmtByParamList(String preparedStmt, List parameterList)
String stm="insert into D_Person(name, last_name, age, idCard, salary, ID$) VALUES(?, ?, ?, ?, ?, ?)";
2.- Create the List of parameters.
Object paramList = Query.Util.newList();
3.- If there is some data type different from the int, string, or double you should add the value to an Object.
//This is special object for Database.Util.addParam in DB is boolean
Object hasIdC = true;
4.- Add the param values in order using the corresponding type.
Database.Util.addStringParam(paramList, "Test");
Database.Util.addStringParam(paramList, "red");
Database.Util.addIntParam(paramList, 25);
Database.Util.addParam(paramList, hasIdC);
Database.Util.addDoubleParam(paramList, 2.25);
Database.Util.addIntParam(paramList, 2);
5.- Execute the query operation (in this case an insert).
int cnt_prepare_insert=Database.executePreparedStmtByParamList(stm,paramList);
https://docs.tibco.com/pub/businessevents-enterprise/6.2.2/doc/html/functions/RDBMS/Database/executePreparedStmtByParamList.html
https://docs.tibco.com/pub/businessevents-enterprise/6.2.2/doc/html/functions/RDBMS/Database/Util/addParam.html