I want to insert or update a row to a table while not updating certain columns of this table.
For example, I set the “sym“ value to be NULL so that the “sym“ column in table tb will not be updated, but an error occurs: At least one item must be non-void in order to create a constant vector. My script is as follows:
timestamp = [09:34:07]
sym = [NULL]
qty = [2200]
price= [49.6]
t = table(timestamp, sym, qty, price)
upsert!(tb,t,keyColNames=`timestamp,ignoreNull=true)
All DolphinDB vectors are typed ones and cannot be void, so you need to convert the type of the “sym“ column. If it is a string, use
sym = ["NULL"]; if it is an integer, usesym = [int(NULL)]orsym = [00i].