How to update properties of relation with condition on date property?

Try this:

call apoc.periodic.iterate(
'
    call apoc.load.jdbc (
        "jdbc:oracle:thin:login/pass@sfpclbd88.prod.mrq:1521/localhost",
        "select origin_node, destination_node, date_b, city from table_relation"
    ) yield row return row
',
'
    match (o:Person{id:row.origin_node})
    match (d:Person{id:row.destination_node})
    match (o)-[r:FOLLOW{date_b:Date(row.date_b)}]->(d)
    call apoc.create.setRelProperty(r, "City", row.city) yield rel 
    return rel
', 
{batchSize:1000, parallel:false})

The "return" is needed because the query complains that the query can't terminate with a call subquery. You can change it to return 1 instead of rel.

1 Like