0

I have a table og_table in the anylogic database that I load data into. From that table, I programmatically iterate on it through selectResultSet, and now I want to re-write those rows with some transformation into new_table. My plan then was just to run some INSERT table ... values() query into new_table that would write line by line.

However, I'm getting a little confused with documentation on which method to use. I see modify(), InsertQuery(), Insert(), etc. What's the difference between these methods?

ocean800
  • 3,489
  • 13
  • 41
  • 73
  • 1
    You seem to be looking just at the raw API and not the help: there's a whole section there on DB queries with examples of INSERT, UPDATE, SELECT and DELETE (as in Artem's answer). – Stuart Rossiter Jun 05 '21 at 07:26
  • @StuartRossiter that helped so much, thank you! – ocean800 Jun 17 '21 at 18:05

1 Answers1

1

If you want to insert into the new table then this should work:

insertInto(new_table)
          .columns(new_table.col1, new_table.col2)
          .values("Value 1", "Value 2")
          .execute();

You may also want to clear the new_table on model start up using this statement: deleteFrom(new_table).execute();

Artem P.
  • 816
  • 1
  • 6
  • 8