0

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() +"%'
1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.