sijms / go-ora

Pure go oracle client
MIT License
812 stars 178 forks source link

Issue with go-ora when using positional Arguments #598

Closed abdelaziz-ouhammou closed 1 month ago

abdelaziz-ouhammou commented 2 months ago

There is an issue when you try to do an update.

the following does not work (no Rows Affected):

db.Exec("UPDATE people set age=:2 where name=:1",name,age)

this works:

db.Exec("UPDATE people set age=:1 where name=:2",age,name)

is this a problem with Oracle or go-ora

sijms commented 2 months ago

because you are using position of the parameter not name so age =:1 is same as age = :2 and the value of them will be the first value passed to Exec after SQL string. to use named parameter see examples. note that positional mode is the default.