Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Data element "nperiod" of type int not supported for databases.Why?

  • 1.  Data element "nperiod" of type int not supported for databases.Why?

    Posted Wed September 14, 2011 09:10 AM

    Originally posted by: SystemAdmin


    When I wrote .dat file connecting to oracle, the data element "nperiod" in .dat file type is int,and in the oracle its type is number, and I run the model, the mistake happening "Data element "nperiod" of type int not supported for databases", I don't why ? And how to solve it?

    Thank you!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Data element "nperiod" of type int not supported for databases.Why?

    Posted Fri September 16, 2011 01:28 PM

    Originally posted by: SystemAdmin


    Hi,

    When reading data from a database, the OPL data you're initializing has to be an array or a set.
    In the documentation for DBRead(), it says "The DBRead instruction is used to read data from a database and insert the data elements into an OPL array or an OPL set."

    If you're interested in getting an integer (not a set nor an array), the workaround is to first read a set and then get that element with something like:
    int period = first(setReadFromDB);
    


    Hope this helps
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Data element "nperiod" of type int not supported for databases.Why?

    Posted Mon September 19, 2011 09:46 AM

    Originally posted by: SystemAdmin


    Thanks!
    It was the problem! And with your help,I've solved it!
    Yes,the data type from or to the database must be array or set, if not,the error message will be shown up.

    Thanks again!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer