sijms / go-ora

Pure go oracle client
MIT License
786 stars 174 forks source link

regarding alter session commands and set define off #412

Closed crbsram closed 1 year ago

crbsram commented 1 year ago

Hi Team

Want to know how to add these alter session set current_schema = user set define off

during the connection initialization similar to onInit in godror. So that entire connection usage these will be inherited.

Pls let us know this is possible.

crbsram commented 1 year ago

Update: _, err := conn.Query("set define off") if err !=nil { fmt.Println("error in setdefine off") }

_, err := conn.Query(" select name from user where name = 'test & test'") if err != nil { fmt.Println("error in executing the query") }

while writing this code received error from Oracle like given below:

ORA-00922: missing or invalid option

Let me know if I am missing anything.

Thanks C.R.Bala

sijms commented 1 year ago

hi @crbsram SET DEFINE ON/OFF is an option of SQL Plus not oracle so your code

_, err := conn.Query(" select name from user where name = 'test & test'")
if err != nil {
    fmt.Println("error in executing the query")
}

will work without SET DEFINE OFF