is there a way to get return_value from stored procedure using gorm?

Viewed 101

I have a stored procedure which will return different int value(0 for normal, -1 for error etc.) But it seems it cannot be passed using gorm. What I've tried is sth like this:

type Res {
  returnVal int `gorm:"column:res"`
}
var res Res
db.raw("declare @return_val int exec @return_val = ? @p1 = ? select 'res' = @return_val", sprocName, param1).Scan(&res)

However the log shows select 'res' = NULL

I also saw this post: Get @Return_Value from stored procedure using Entity idk if this means that return value actually should not appear outside sql?

TIN

0 Answers
Related