Toad World® Forums

Using LEFT, MID, RIGHT


#1

I am certainly an SQL rookie, so forgive the rudimentary question, but in SQL Navigator, how do I include string manipulation in a query.

I get an error ORA_00904: “LEFT” invalid identifier.

Is there no way to do a where clause that evaluates a partial value?

Such as

SELECT * FROM A.TABLE WHERE LEFT(A.Column, 2) = ‘XY’


#2

You want to take a look at the SUBSTR function.

That allows you compare or work with a piece of a string.

So you could do
SELECT * FROM A.TABLE WHERE SUBSTR(A, 1, 2) = ‘XY’;

You can take advantage of the Code Assistant to speed along your uptake of Oracle’s SQL syntax.


#3

Thanks.

Wow, that’s a little embarrassing to miss that, but it sure helps a lot.

Great stuff.