Oracle LIKE statement on SQL Server 2005

5 pts.
Tags:
LIKE statement
Oracle 10g
Oracle Statements
SQL Server 2005
I'm trying to execute the LIKE statement but it's not displaying  any values



SELECT R_NAME FROM LAWSON.DEPTCODE WHERE (R_NAME LIKE :r_name)





Software/Hardware used:
oracle 10g

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

Oracle SQL syntax, like most, requires a wild card to accurately use a LIKE

% is a wild card that means zero or more characters
_ is a wild card that means one (and only one) character

col1 LIKE ‘ABC%’
would search col1 looking for values that start with ABC, whether anything follows or not.

WHERE col1 LIKE ‘%ABC’
searches col1 for values that end with ABC, whether anything come before it or not

WHERE col1 LIKE ‘_ABC%’
searches for values that have ABC beginning in the second position, whether anything follow or not

WHERE col1 LIKE ‘%ABC%’
searches for ABC anywhere in col1

In your case, you will need to have one or more wild cards in your host variable.

I hope this helps.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    You need to provide more details. Why did you title your question "Oracle LIKE statement on SQL Server 2005" ? where are you running this command ? What's the value you are using for the :r_name bind variable ?
    69,175 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following