In my data Postcode records are as below
1.'ABC XYZ'
2.' EFG PQR'
Requirements is to get all character before space So for first record ,I am getting expected result if I am putting
select NVL(substr(postcode,0,instr(postcode,' ')-1), postcode)
But for second record I am getting whole postcode value . Because in second record ' '
(space is at very beginning).
I tried multiple query but not getting the results .
I want single expression which handles both scenarios.