1

I need to execute the stored procedure ctx_ddl.sync_index on an Oracle database. In a query program this works;

EXECUTE ctx_ddl.sync_index('MyIndex');

When I try to run in dapper with the following;

using var connect = new OracleConnection(conString);
var results = connect.Execute("ctx_ddl.sync_index", "MyIndex", commandType: CommandType.StoredProcedure);

It gives me the following error:

ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SYNC_INDEX'

What am I doing wrong?

Xaphann
  • 3,195
  • 10
  • 42
  • 70

1 Answers1

1

Instead of passing "MyIndex" as a string, try this:

using var connect = new OracleConnection(conString);

var p = new OracleDynamicParameters();
p.Add("THENAMEOFYOURPARAMETER", dbType: OracleDbType.THETYPEOFYOURPARAMETER, direction: ParameterDirection.Input);

var results = connect.Execute("ctx_ddl.sync_index", param:p, commandType: CommandType.StoredProcedure);
Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122
  • Stupid question: What namespace/NuGet is OracleDynamicParameters in? – Xaphann Sep 23 '20 at 21:57
  • 1
    Not stupid.. Should just be in `Dapper`, but I don't have VS here to verify. – Wouter van Nifterick Sep 23 '20 at 23:42
  • So its not in the Dapper, but I did find it in Dapper.Oracle.DynamicParameter. The issue is it hasn't been updated since 2018. I am running .NET Core and that is giving a version issue with Oracle.ManagedDataAccess.Core – Xaphann Sep 24 '20 at 14:03