Oracle get substring before a space Oracle get substring before a space oracle oracle

Oracle get substring before a space


Substr (quarter_cd, 1,instr(quarter_cd,' ') - 1)

Should do that.


SELECT Rtrim(Substr('123642134  10',1,Instr('123642134  10',' '))) AS quarter_cd FROM dual;

Uses of string function used in upper query

  • Instr()- to get position of any character or space from the given string.
  • Substr()- to get substring from given string.
  • Rtrim()- to remove spaces from right side.