Kasper Hansen Kasper Hansen - 2 months ago 15
C# Question

Why can't I execute the stored procedure? (OracleException was caught)

This is code to connect to an Oracle database. It fails at the last line: dbDataAdapter.Fill(dtResult);

private object Execute(CommandType commandType, Common.DATA.SqlCommonExecutionType sqlCommonExecutionType, DbCommand dbCommand)

dbc = dbConnection.CreateCommand();
dbc.CommandType = commandType;
dbc.CommandText = dbCommand.CommandText;
dbc.CommandTimeout = 3600;

if (dbc.Connection.State == ConnectionState.Closed)
dbc.Connection.Open();

DataTable dtResult = new DataTable();
DbDataAdapter dbDataAdapter = dbProviderFactory.CreateDataAdapter();
dbDataAdapter.SelectCommand = dbc;
dbDataAdapter.Fill(dtResult);


The error is "OracleRxception was caught:

ORA-06550: line 1, column 7:
PLS-00201: identifier 'RESETUNFINISHEDJOBS' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


I have access to the database through Oracle SQL*Plus. Why am I getting this error? Is the stored procedure missing on the database side or is it my code? Any ideas of how to solve this?

Answer

You may need to define schema.package.storedprocedure (or schema.table) in your commandtext

Instead of:

select * from table

Use:

select * from schema.table

... and the same applies for functions/stored procedures

If your commandText contains just the stored procedure:

storedprocedurename

Try:

schema.package.storedprocedurename