Thanks for the reply. I hope this helps illustrate the issue.
This statement confirms connection is correct and can access DB. No issues here.
```{sql connection="conn"}
select sysdate from dual
```
There is an '&' in the data inside a case statement so I need to set escape on so it doesn't parse this. In SQL Dev this is necessary for my script to run otherwise there's a prompt to insert a bind variable. Output in SQL Dev for this statement is "session altered". This setting holds until the connection is closed.
This does not run in RMD.
```{sql connection="conn"}
set escape on
```
I get this error:
Error in .oci.SendQuery(conn, statement, data = data, prefetch = prefetch, :
ORA-00922: missing or invalid option
Failed to execute SQL chunk
I get the same error if I run it this way instead
```{r}
dbSendQuery(conn, "set escape on")
```