Introduction

You can use both SUBSTR and INSTR for parsing text.

For example, to print out the last word in the string, you can use the following code:

Demo

SQL>
SQL> declare-- from   w w  w.ja v a  2 s.c o  m
  2      v1_tx VARCHAR2(20):='Hello to everybody';
  3      v2_tx VARCHAR2(20);
  4  begin
  5      v2_tx:= substr (v1_tx, instr (v1_tx,' ',-1)+1);
  6      DBMS_OUTPUT.put_line(v2_tx);
  7  end;
  8  /
everybody

PL/SQL procedure successfully completed.
SQL>

Related Topic