# Call apoc.do.case does not work

**URL:** <https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089>\
**Category:** Cypher\
**Created:** [June 28, 2023, 1:57pm UTC](https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089 "2023-06-28T13:57:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marwa.elabri1](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marwa.elabri1](https://community.neo4j.com/u/marwa.elabri1)\
**Post date:** [June 28, 2023, 1:57pm UTC](https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089/1 "2023-06-28T13:57:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jennifer\_reif](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jennifer_reif/32/8061_2.png) [@jennifer\_reif](https://community.neo4j.com/u/jennifer_reif)\
**Post date:** [June 28, 2023, 2:16pm UTC](https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089/2 "2023-06-28T14:16:50Z")

</div>

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?

```auto
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})

```

---

<div class="post-metadata">

**Author:** ![marwa.elabri1](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marwa.elabri1](https://community.neo4j.com/u/marwa.elabri1)\
**Post date:** [June 28, 2023, 2:47pm UTC](https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089/3 "2023-06-28T14:47:18Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/5/2/523e989355726e0cbf7fcf94fa412931c9639dac.png)

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [June 29, 2023, 11:53am UTC](https://community.neo4j.com/t/call-apoc-do-case-does-not-work/63089/4 "2023-06-29T11:53:24Z")

</div>

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.
