Originally posted by: SystemAdmin
[Boon said:]
OK, just figured it out.
Declare variable in .mod file like this ....
string Output= "Create table " + TableName + "(ID real,.........)"
Now my next problem.Normally, I drop a table, create a table, and update the result like this...
DBExecute(db,"drop table Result");
DBExecute(db,"create table Result(oil varchar(10), gas varchar(10), blend real, a real)");
Result to DBUpdate(db,"INSERT INTO Result(oil,gas,blend,a) VALUES(?,?,?,?)");
The problem is if I don't have a table Result already exists in the database, this code would give me an error. (I notice that I don't see error when I ran in OPL. It just gave me a warning and seems to be working fine. But, It didn't work when I use oplrun in command line. It stucked at the drop table error and stopped the process.)
What I want to do is --> if there is no table Result in the database, then create it. If there is table Result in the database already, just replace it. (note that I need to create a new table because sometimes a user can arbitrary choose a table name.)
Thank you!
#DecisionOptimization#OPLusingCPLEXOptimizer