In the topic How many statements can I drive from one CSV LOAD?, @glilienfield shows me that I CAN have multiple statements for the same LOAD.
So, for this particular load, we have the following:
WITH some preliminary global variables
LOAD the CSV
Execute some MATCHes to gather the variables we'll need later
Execute the first set of MERGEs to create some nodes and relationships (based on some CSV columns)
Execute a second set of MERGES to create related nodes and relationships (based on the same column set).
Execute a third set of MERGES to create related nodes and relationships (based on a different column set).
My problem is that the third set of columns is NOT always present (i.e. the values returned are NULL). I initially thought, "that's no problem, the third set of MERGEs will fail, and the specific nodes and relationships won't be created".
But that's NOT what happens! The entire LOAD fails, and nothing is created!
I would like to conditionalise the execution of the third set of MERGEs based on the fact that the returned column value is NULL. Is that possible? The only conditionalisation I know (as a newbie) is CASE, but this is a subordinate clause to a higher-level statement. Have I understood that correctly?
TIA,
Paolo