Update two columns in a table

I am trying to update a row in a database table using two SQL statements. My script:

param1 = {"IG_Tag":"SCADA_ALARM_CP01_0_2"}
param2 = {"IG_Index":Idx}

system.db.runNamedQuery("Get_Alarm", param1)
system.db.runNamedQuery("Update_Display", param1, param2)

The first Query works fine (sets a bunch of column values in the ‘igeventdisp’ table)
The second Query is:

UPDATE igeventdisp 
SET IG_Event_Set_Time = current_timestamp(0), IG_Event_Index = :IG_Index

The error is “Transaction “{’,IG_Index’: 103.0}” is closed.”

I have tried wrapping the first query with:
system.db.closeTransaction("") {with and without system.db.commitTransaction("")}

Each query runs fine when executed by themselves.
Do any DB people have a clue, (as I am clueless)?

You will need to combine the parameters for the 2nd runNamedQuery.

system.db.runNamedQuery(path, parameters, [getKey])
system.db.runNamedQuery(project, path, parameters, [getKey])

I added :

params = [param1, param2]
system.db.runNamedQuery("Update_Display", params)

Now my error is:
Cannot coerce value ‘[{‘IG_Tag’: ‘SCADA_ALARM_CP01_0_2’}, {‘IG_Index’: 103.0}]’ into type: interface java.util.Map

Parameters need to be within one set of curly braces, as key pairs.The second named query needs two parameters, you would pass something like the following (note the comma separating each key pair):

params = {"IG_Tag":"SCADA_ALARM_CP01_0_2" , "IG_Index":Idx }
1 Like

Thank you so much.