Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 264
CodeFox Avatar asked Apr 20 '26 07:04

CodeFox


1 Answers

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


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!