ORA-1036 when executing function without params

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
dcoracle600pro
Posts: 51
Joined: Mon 09 Apr 2012 09:57

ORA-1036 when executing function without params

Post by dcoracle600pro » Wed 22 May 2013 15:00

Hi, I'm trying to execute a function who has no parameters. This function return a varchar

I receive an error ORA-0136: illegal variable name/number

Here is my code :

Code: Select all

using (GeneralEntities dataContext = this.GetEntitiesObject<GeneralEntities>())
{
    OracleConnection connexion = (dataContext.Connection as EntityConnection).StoreConnection as OracleConnection;
    connexion.Open();
    OracleCommand command = new OracleCommand("dbpc_cloee.getDatabasePlainText",connexion);
    command.Parameters.Clear();
    OracleParameter pReturn = new OracleParameter();
    pReturn.Direction = System.Data.ParameterDirection.ReturnValue;
    pReturn.OracleDbType = OracleDbType.VarChar;
    command.Parameters.Add(pReturn);
    command.ExecuteNonQuery();

    return (string)pReturn.Value;
}
I use almost the same code to execute another function who has parameters and it works fine.

Any idea ?

Thanks !

PS: EF4.50 - dotConnect 6.60

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: ORA-1036 when executing function without params

Post by Shalex » Thu 23 May 2013 13:29

Please replace

Code: Select all

OracleCommand command = new OracleCommand("dbpc_cloee.getDatabasePlainText",connexion);
with

Code: Select all

OracleCommand command = new OracleCommand("dbpc_cloee.getDatabasePlainText",connexion);
command.CommandType = System.Data.CommandType.StoredProcedure;
and notify us about the result.

dcoracle600pro
Posts: 51
Joined: Mon 09 Apr 2012 09:57

Re: ORA-1036 when executing function without params

Post by dcoracle600pro » Fri 24 May 2013 13:56

Oh no, it was so simple...

Yes, it works now.


Thank you !

Post Reply