sijms / go-ora

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

Upgrade to v2.7.12+ issue #435

Closed askripalev closed 9 months ago

askripalev commented 1 year ago

Hi!

After upgrade from v2.7.11 to v2.7.12 or later some queries stop working and error "ORA-01008: not all variables bound" occurs.

This won't work now:

    params := []any{
        sql.Named("test1", 44),
        sql.Named("test2", 2),
        sql.Named("test3", 300),
    }

    _, err := conn.Query("select :test1||:test1||:test2||:test3 from dual", params...)
    if err != nil {
        fmt.Println("DEBUG:", err.Error())
    }

Query like this is still working, of course:

...
    _, err := conn.Query("select :test1||:test2||:test3 from dual", params...)
...

And this works as well:

...
    _, err := conn.Query("select :test1||:test2||:test3||:test3 from dual", params...)
...

P.S. Code and query are much simplified, but still :)

sijms commented 1 year ago

named parameter is not implemented for query (only exec) I wil fix in next release and inform you

sijms commented 1 year ago

I test you code with c# driver and result is same error ORA-01008: not all variables bound

I also test named parameter in where clause and work without error

askripalev commented 1 year ago

The question is why the same code worked okay prior v2.7.12 (v2.7.11 and lower)? I'm using v2.7.9 now and have no described issue.

sijms commented 11 months ago

the way I use in v2.7.11 work with select but give error with pl/sql so to fix the issue I should merge the 2 solution sorry I didn't add the solution in v2.7.18 because it need more testing before release but I will add it soon and publish new release

sijms commented 9 months ago

fixed in v2.7.22