I am trying to parameterise all our existing sql, but the following code is giving me a problem:
command.CommandText = String.Format("SELECT * FROM({0})
WHERE ROWNUM <= :maxRecords", command.CommandText);
command.Parameters
.Add("maxRecords", OracleType.Int32).Value = maxRecords;
The error reported is “ORA-01036: illegal variable name/number”.
I assume that this is because OracleType.Int32 is not the correct datatype for ROWNUM. So what is it?
In SQLPlus we can create a view that includes
rownumto see exactly what datatype Oracle uses:So to Oracle, this pseudocolumn is a Number. Which based on this link ( http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/datatype.htm#i16209 ) can hold: