Gorm: Get output parameter after executing stored procedure

Created on 24 Aug 2018  ·  3Comments  ·  Source: go-gorm/gorm

How can I fetch output parameter after executing a stored procedure.

      outparam :=""
      query := "set nocount on; exec [sp_runme] '" + param1 + "'"
 rows, execErr := dbConn.Query(query)
 if err != nil {
    fmt.Println("error",err)
}
rows, err := statement.Query(query)
if err != nil {
    fmt.Println("error",err)
}
for rows.Next() {
    err := rows.Scan(&outparam)
    if err != nil {
    fmt.Println("error",err)
    }
     fmt.println("output param",outparam)

Thanks in advance!!

gorm_v1 question

All 3 comments

I'm having the same issue

Are there any news on this?

This issue will be automatically closed because it is marked as GORM V1 issue, we have released the public testing GORM V2 release and its documents https://v2.gorm.io/docs/ already, the testing release has been used in some production services for a while, and going to release the final version in following weeks, we are still actively collecting feedback before it, please open a new issue for any suggestion or problem, thank you

Also check out https://github.com/go-gorm/gorm/wiki/GORM-V2-Release-Note-Draft for how to use the public testing version and its changelog

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanyuen picture alanyuen  ·  3Comments

bramp picture bramp  ·  3Comments

kumarsiva07 picture kumarsiva07  ·  3Comments

zeropool picture zeropool  ·  3Comments

corvinusy picture corvinusy  ·  3Comments