Page 1 of 1

ORA-1036 when executing function without params

Posted: Wed 22 May 2013 15:00
by dcoracle600pro
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

Re: ORA-1036 when executing function without params

Posted: Thu 23 May 2013 13:29
by Shalex
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.

Re: ORA-1036 when executing function without params

Posted: Fri 24 May 2013 13:56
by dcoracle600pro
Oh no, it was so simple...

Yes, it works now.


Thank you !