System.Data.OracleClient.OracleException: ORA-01036: illegal variable name/number

Is anyone familiar with this error?

System.Data.OracleClient.OracleException: ORA-01036: illegal variable name/number

I get it when calling oracle stored procedures

Here is a sample of my code:

m_oracleCommand[0].CommandType = System.Data.CommandType.StoredProcedure;

for (int i = 0; i < this.DbParamsCollection.Count; i++)
{
p = (FocusDbParameter)this.DbParamsCollectionIdea;
m_oracleCommand[0].Parameters.Add(":" + p.ParameterName, p.Value).Direction = System.Data.ParameterDirection.Input;
m_oracleCommand[0].ParametersIdea.Size = p.Value.ToString().Length;

}
m_oracleCommand[0].CommandText = "FOCUS_RPT.FOCUS_RPT_B3";
m_oracleCommand[0].Connection = m_arrOracleConn[0];

Thanks,

Doug

[916 byte] By [drdexter33] at [2008-1-8]
# 1

Doug,

Try leaving off the ":" before the parameter name. This prefix is needed for in-line parameters, but not stored procedure parameters.

I hope this information proves helpful.

DavidSceppa-Microsoft at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 2

This kind of problem i encountered 4 to 5 times and everytime i found a different problem. Most of the time the underlying problem is with paramaters.

Check following when you get this error.

1. parameter name which you are setting and which you are passing in the insert, update and delete commands.
2. Values : If you try to pass string to a number datatype.
3. Null Values. Null values has to be handled seperately for Delete and update
Example : (ColumnName = :pColumn_Name OR :pColumn_Name IS NULL AND ColumnName IS NULL);
4. Datatypes of hose columns in Oracle table with the Datatable columns
5. Check spaces in the parameter name.

I hope above tips may help you in resolving the problem.

vutkuri at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 3

Looks like you have to clear your parameters right before creating the first one.

You have to also clear your parameter right after any execution.

user this command and see if it works:

cmd.Parameters.Clear()

good luck.

ghAfgh at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...

.NET Development

Site Classified