Get value of Oracle OUT parameter from a stored procedure call using Dapper.NET
I know this is extremely late and may be common knowledge to most everyone but me, but there is a comment in the original message from not too long ago, so I'll describe how I got around the issue of having a cursor out parameter as well as non-cursor out parameters.
Since my example only has one Oracle cursor, I can user the Query method. The results of the other out parameters are in the parameters themselves and can be retrieved with the Get<> method in the OracleDynamicParameters class.
The other important part for me was to add a size to my out parameters, otherwise they were coming back as null or empty strings.
Below is a sample of the code I'm using.
using (IDbConnection db = new OracleConnection(connectionString)) { var p = new OracleDynamicParameters(); p.Add("p_first_parameter", someParameter, OracleDbType.Varchar2, ParameterDirection.Input); p.Add("o_cursr", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output); p.Add("o_sqlerrm", dbType: OracleDbType.Varchar2, direction: ParameterDirection.Output, size: 200); p.Add("o_sqlcode", dbType: OracleDbType.Varchar2, direction: ParameterDirection.Output, size: 200); dynamic csr = db.Query("myStoredProcedure", p, commandType: CommandType.StoredProcedure).ToList().First(); string code = p.Get<OracleString>("o_sqlcode").ToString(); if (code != "0") { string errm = p.Get<OracleString>("o_sqlerrm").ToString(); throw new Exception($"{code} - {errm}"); }}