I tried to make this query to export some data from a relational table to neo4j using apoc.do.case but it does not work
call apoc.periodic.iterate('call apoc.load.jdbc("jdbc:oracle:thin:connexion_statement","tablename") yield row', ' with row
call apoc.do.case([
row.dat_nais is not null, "create(p:node{name:row.name,dat_nais:row.dat_nais}"],
"create(b:node{name:row.name,dat_nais:'0001-01-01'})",
{batchsize:1000,parallel:true})
when I make it like this it gives me syntax error on '0001-01-01'
but when I put it as number not string like this dat_nais:0001-01-01
It gives me an error: queryexcutionexception:failed to invoke procedure apoc.do.case caused by syntax exception variable row not defined "create(p:node{name:row.name,dat_nais:row.dat_nais}"
could some one plaese help me to correct
Thanks
I think the only issue is a missing parenthesis at the end of the first CREATE statement. If you add that, do the errors disappear?
call apoc.periodic.iterate('call apoc.load.jdbc("jdbc:oracle:thin:connexion_statement","tablename") yield row', ' with row
call apoc.do.case([
row.dat_nais is not null, "create(p:node{name:row.name,dat_nais:row.dat_nais})"],
"create(b:node{name:row.name,dat_nais:'0001-01-01'})",
{batchsize:1000,parallel:true})
Thank you Jennifer for your response but I already put it in my request
juste here I forgot it when writing the request here because I cannot copy it directly
I think it has to do with an inconsistent use of single and double quotes to delimit items. In your second statement of the apoc periodic iterate, you begin the statement with a single quote, but you end it with a double quote. I believe the single quote used to enclose the date is confusing the parser to when the second statement of the periodic iterate ends.
Your periodic iterate statements are enclosed in strings, which you use double quotes for. This is correct. Within your strings you have this literal date that needs to be wrapped. The problem here is you already have single quotes at the outer level and double quotes at the inner level. You could try escaped quotes to surround the literal date or pass the date as a periodic iterate parameter and reference the parameter in place of the literal date, thus avoiding needing quotes.