Oracle Query Problem
Posted on 2006-07-24
Here is my query:
SELECT R.COMPONENT, substr(R.COMPONENT,1,instr(R.COMPONENT,' ')-1)
FROM CPI.NAI_RESULTS R
It is looking a row and seeing if R.COMPONENT has a space in it, then it will get all the information before the first space.
That is correct.
I want to return the word if there is no space at all. Here is some examples:
one two three <-- should return one (this would work currently)
one two <-- should return one (this would work currently)
one <-- should return one (this doesn't work right now. It returns nothing.)