Share
 
 

Insertion

It is possible to insert objects into the network and insert rows into blobs.

To add individual objects the syntax is:

INSERT INTO<table name> (field1, field 2,... fieldn) VALUES (val1,val2,... valn)

INSERT INTO node (node_id,x,y) VALUES ('N1', 123, 456)

The number of values must match the number of fields. All the values can be scalar expressions e.g. scalar variables, expressing including scalar variables.

To add individual rows into an individual object's structured blob the syntax is:

INSERT INTO <table name>.<blob name> (field1,field,2... fieldn) VALUES (val1,val2,... valn)

The field names must be either:

  1. a key field name of the table
  2. the array name followed by a . followed by a field in the blob

All key field names of the table must be specified and objects into which lines in the structure blob are being inserted must exist.

To insert values into a table from a SELECT statement, the syntax is:

INSERT INTO <table name> (field1,field2,... fieldn) SELECT <select statement>

To insert values into a structure blob from a SELECT statement the syntax is:

INSERT INTO <table name>.<blob name>(field1,field2,... fieldn) SELECT <select statement>

As with the values insert statement, the field names must be either:

  1. a key field name of the table
  2. the array name followed by a . followed by a field in the blob

All key field names of the table must be specified and the objects into which lines are being inserted must exist.

The number of items being selected must match the number of fields being set in the INSERT.

The select statement can include WHERE and ORDER BY but not GROUP BY or HAVING and can include selection of SCENARIO, TOP and BOTTOM and SELECTED etc.

It is possible to add objects to a scenario by adding the scenario details after the list of fields e.g.

INSERT INTO node(node_id,x,y) IN BASE SCENARIO VALUES ('N2',3,4)

INSERT INTO node(node_id,x,y) IN SCENARIO 'SC1' VALUES ('N3,4,5)

Was this information helpful?