How does go call oracle’s stored procedures and get the return value of the stored procedures?

  golang, question

How does go call oracle’s stored procedures and get the return value of the stored procedures? I saw in github of goracle.v2 that the driver can get the return value and only need to pass a goracle.PlSQLArrays to the Exec method, but I tried unsuccessfully. Please give us some advice. Attach your own code as follows:

func main() {
 db, err := sql.Open("goracle",  "ods_bak/odsbak@110.1.5.54:1521/ODS_DEV" )
 if err !  = nil {
 fmt.Println(err)
 return
 }
 defer db.Close()
 loginStmt,err:=db.Prepare("begin login(:1,:2,:3);  end;"  )
 defer loginStmt.Close()
 var mail string = "1"
 var pwd string = "2"
 var retVal string
 loginStmt.Exec(goracle.PlSQLArrays,mail,pwd,&retVal)
 fmt.Println(retVal)
 }

The stored procedure code is as follows:

create PROCEDURE login(u_mail_in IN VARCHAR2,
 u_pwd_in IN VARCHAR2,
 retval OUT VARCHAR2)
 AS
 l_count NUMBER     ;
 BEGIN
 retval := u_mail_in||u_pwd_in;
 
 END   login;

Result

I’ve done it myself … use sql.Out to receive the return value parameters.