c++arraysoracle-databaseocci

Save an std::map<int, std::vector<int>> in Oracle12c


How do I store an array of numbers in an Oracle column?

I have an std::map> mymap and I want to store all data in the mymap in the table.

The table should have two columns

  1. an id, the key of the mymap
  2. and this is what I am looking here

What data type is needed to store the std::vector which represents the value of my key?

How it is done in Oracle12c?


Solution

  • You could serialize the vector to a comma separated list of numbers (or some other format) and store that, then deserialize when reading. Just one of many options. Another would be to store the individual numbers in some other table with a key indicating they are the same "vector". It could be solved in many ways.