CodeFox
CodeFox

Reputation: 3502

How to call a PL/SQL function returning an OracleRefCursor with Linq2DB?

I would like to call a PL/SQL function that returns a SYS_REFCURSOR.

One of the ways I have tried looks like this:

var userIdParameter = DataParameter.Decimal("userId", user.Id);
var returnValue = new DataParameter { Direction = ParameterDirection.ReturnValue };
var result = dataConnection.ExecuteProc("SECURITY.GetUserRoles", userIdParameter, returnValue);

This produces the following error:

PLS-00382: expression is of wrong type

Are functions returning a SYS_REFCURSOR supported by Linq2DB?

Upvotes: 3

Views: 758

Answers (1)

user1641529
user1641529

Reputation:

Support for such parameters was added in Linq2DB 1.8. You need to add DataType = DataType.Cursor to return parameter.

See example in linq2db tests: https://github.com/linq2db/linq2db/blob/master/Tests/Linq/DataProvider/OracleTests.cs#L1881

Upvotes: 3

Related Questions