I wrote a simple parameterized query the other day against an Oracle database as follows:
Then in my application, I assign the value to the parameter as follows:
cmd.Parameters.Add(new OracleParameter(":uid", OracleDbType.Varchar2));
However, when I was trying to run my application, I got an error saying:
ORA-01745: invalid host/bind variable name
Can you see what is causing the error?
It took me hours of Google search until I realized that “uid” is actually a keyword in Oracle, even though there is a “:” colon in front of it, Oracle still thinks it is a reserved word and throw the error above. I am going to faint.