Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

Use the SUBSTR and INSTR at the same time

To print out the last word in the string: SQL> declare   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>