Comments (2)
code:
package main
import (
"database/sql"
"fmt"
go_ora "github.com/sijms/go-ora/v2"
"os"
"time"
)
func exec(db *sql.DB) error {
t := time.Now()
sqlText := `BEGIN
SELECT 'a', 'b' into :aVar, :bVar FROM DUAL;
END;`
var aVar, bVar string
_, err := db.Exec(sqlText, sql.Named("bVar", go_ora.Out{Dest: &bVar, Size: 5}),
sql.Named("aVar", go_ora.Out{Dest: &aVar, Size: 5}))
if err != nil {
return err
}
fmt.Println("aVar: ", aVar, "\tbVar: ", bVar)
fmt.Println("finish exec: ", time.Now().Sub(t))
return nil
}
func main() {
db, err := sql.Open("oracle", os.Getenv("DSN"))
if err != nil {
fmt.Println("can't connect: ", err)
return
}
defer func() {
err = db.Close()
if err != nil {
fmt.Println("can't close connection: ", err)
}
}()
err = exec(db)
if err != nil {
fmt.Println("can't exec: ", err)
return
}
}
result:
aVar: a bVar: b
finish exec: 1.286287703s
from go-ora.
Thank you for the quick response.
It seems my project was using an old version, which seeing your response prompted me to double check. After updating, this is working as intended. Thank you for testing with me and apologies for my ignorance.
from go-ora.
Related Issues (20)
- OCI IAM Token Authentication support in ADB HOT 1
- SELECT FOR UPDATE causing array out of bounds and panic HOT 1
- 2.8.10 is returning int column as string HOT 10
- ORA-00911: invalid character HOT 1
- ORA-00900: invalid SQL statement
- go_ora.AddSessionParam(db, k, v) put values to global driver hashmap HOT 2
- An EOF error is reported during ping HOT 2
- Panic in v2 `network.Session.GetInt64`: slice out of bounds HOT 3
- 2.8.8 drop JSON support? ORA-40569: Unimplemented JSON feature. HOT 5
- Insert with returning value using prepared statement hanging HOT 2
- unregister custom type: ANYDATA. call RegisterType first HOT 3
- long type get a error(ORA-03146:invalid buffer length for TTC field) HOT 5
- All data types are cast to string when query results are parsed HOT 5
- Connection error on v2.8.12 HOT 10
- Timestamp with Local Time Zone conversion HOT 8
- 'ORA-03146: invalid buffer length for TTC field' on procedure call with out parameter
- ORA-01013 in v2.8.13 HOT 24
- 'ORA-01009: missing mandatory parameter' during select for CLOB columns on 2.8.13 HOT 2
- Use struct with Select many rows query HOT 3
- The canceling context in version 2.8.14 has a race condition issue. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-ora.