You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using database/sql package with oracle driver (“gopkg.in/rana/ora.v4”), when I am inserting the data, it’s LastInsertId Method is returning 0, while data is successfully inserted.
Attaching code.
Hi,
I am using database/sql package with oracle driver (“gopkg.in/rana/ora.v4”), when I am inserting the data, it’s LastInsertId Method is returning 0, while data is successfully inserted.
Attaching code.
import (
“database/sql”
“fmt”
_ "gopkg.in/rana/ora.v4"
)
func main() {
conn, err = sql.Open(“ora”, username+"/"+password+"@"+host+":"+port+"/"+sid)
query := “INSERT INTO Table (C2) VALUES (:C2)”
result, err := conn.Exec(query, “Test”)
if err!= nil {
panic(err)
}
lastId := result.LastInsertId() // returning 0
fmt.Println(lastId)
}
Please tell me why this is happening?
The text was updated successfully, but these errors were encountered: