I'm calling from another class for this function which does the setting of the arguments into a prepared Statement according to their data types. I have a rough idea of how it is to be done, but I can't seem to get it right. How do I use the function to set the parameters into the sql statement via prepared statements?
I think you can use my approach:
if (arguments[i] instanceof String){
//set the strings into the varchar2 fields
preparedStmt.setString(i+1, arguments[i].toString());
}
else if (arguments[i] instanceof Integer){
System.out.println("Integer " + i);
//set the integers into the integer fields
preparedStmt.setInt(i+1, Integer.parseInt(arguments[i].toString()));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.