I've begun utilising SUBSTR and INSTR in Oracle, but when I came across this, I became perplexed.
SELECT PHONE, SUBSTR(PHONE, 1, INSTR(PHONE, '-') -1)
FROM DIRECTORY;
I get that SUBSTR trims off values and INSTR identifies the location of the occurrence, but the example I provided above has me perplexed because the outcome is 362. I was 362-127-4285 when I was first valued. How does that function?