how does the go language call the stored procedure of oracle and get the return value of the stored procedure? I saw in goracle.v2 "s github that the driver could get the return value by passing a goracle.PlSQLArrays, to the Exec method, but I tried unsuccessfully. Please give me a lot of 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