Reputation: 397
I am having trouble using parameters for my in line oraclae query in c#. Why does the parameter not work within the wildcard?
This line returns no results:
Select id, name from Users where UPPER(name) like '%:name%'
command.Parameters.Add("name", OracleDbType.Varchar2, name.ToUpper(), ParameterDirection.Input);
But this returns:
Select id, name from Users where UPPER(name) like '%" + name.ToUpper() +"%'
Upvotes: 0
Views: 1004
Reputation: 4551
Did you mean this?
Select id, name
from Users
where UPPER(name) like '%' ||:name.ToUpper()||'%'
This concatenates your C# variable and the Oracle wildcard characters.
Upvotes: 1