Drizin / Drizin/DapperQueryBuilder

oracle stored procedure returning cursor

Open
#68 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
541
Forks
49
PR merge metrics
No merged PRs in 30d

Description

I just found your package and I think it will make my code read a ton better. Right now, my code looks like the first code block. It works fine, but I would like to make my code look the second code block, but it can't seem to figure out how to set the returning cursor. I think I'm close in the second code block. As you can see, I'm stuck in an oracle database where every stored procedure returns a refcursor.

```
List data;
var connStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
using (var connection = new OracleConnection(connStr))
{
var values = new OracleDynamicParameters();
values.Add("i_uic", Uic, OracleMappingType.Varchar2, ParameterDirection.Input);
values.Add("o_cur", dbType: OracleMappingType.RefCursor, direction: ParameterDirection.Output);

data = connection.Query("jcn_exports.get_work_notifications", values, commandType: CommandType.StoredProcedure).ToList();
}
```

```
List data;
var connStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
using (var connection = new OracleConnection(connStr))
{
var ocur = new OracleParameter("o_cur", OracleDbType.RefCursor, ParameterDirection.Output);
var query = connection.SqlBuilder(
new InterpolatedSqlBuilderOptions(){DatabaseParameterSymbol = ":"},
$"jcn_exports.get_work_notifications({Uic}, {ocur})");
data = query.Query().ToList();
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.