Here's my code:
string cmd = "UPDATE MyTable SET Status='A' WHERE CaseId='123' RETURNING DocId INTO :UpdatedDocId";
DynamicParameters para = new DynamicParameters();
para.Add("UpdatedDocId", direction: ParameterDirection.Output, dbType: DbType.String, size: 50);
await db.ExecuteAsync(cmd, para);
var tempOutputValue = para.Get<dynamic>("UpdatedDocId");
If there is only one row updated, I can get the updated DocId as tempOutputValue correctly, but if there are two or more rows updated, I got error like this: ORA-24369: Required callbacks not registered for one or more bind handles
Is there any way I can get all updated DocIds?
In Oracle, you would use
RETURNING column_name BULK COLLECT INTO collection_variable.Which, if you were going to implement it in PL/SQL would be:
You would need to change your code from
INTOtoBULK COLLECT INTOand pass it into an bind variable that could accept an array.However, C# does not support passing Oracle SQL collection data types so it may not be possible (no idea why, you can do it in other languages but the C# drivers do not support it). It does support PL/SQL associative arrays so you may be able to
BULK COLLECT INTOan SQL collection and then convert the SQL collection to a PL/SQL associative array and return that.First, within the database, create a package defining the associative array:
Then you can use something like (untested as I don't have C#, based on code from this question):
Oracle fiddle