Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL like clause -> starts with

ryvantageJul 27 2011 — edited Jul 27 2011
Hello,

I am converting an app from one DB platform to Oracle, and my previous SQL syntax contained "starts with" code. eg,
select * from employees where name starts with 'ry';
From this webpage (http://www.techonthenet.com/sql/like.php) I understand to do this in Oracle it is like this:
select * from employees where name like 'ry%';
However, there are situations where I use starts with on an inner join, where I need the match to be on a table column instead of a string literal.

For example:
select *
from user usr
inner join salesperson sp on usr.salesperson_code starts with sp.salesperson_code;
I know this seems peculiar (ie, why don't I just use equals?), but this is because the DB is setup so that users can have multiple salesperson entries for different sales operations.

So how would I tackle this in Oracle?

Thank you in advance for your help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2011
Added on Jul 27 2011
2 comments
13,388 views