Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

TRIM

Remove characters from a string. LTRIM does it from the left side of the string PTRIM does from the right side. TRIM does it from the both side. SQL> SQL> declare   2      v1_tx VARCHAR2(20):='Hello!';   3      v2_tx VARCHAR2(20);   4      v3_tx VARCHAR2(20);   5  begin   6      v3_tx:= trim (both '*' from v2_tx);   7      DBMS_OUTPUT.put_line(v3_tx);   8      v3_tx:= trim (leading '*' from v2_tx);   9      DBMS_OUTPUT.put_line(v3_tx);  10      v3_tx:= trim (trailing '*' from v2_tx);  11      DBMS_OUTPUT.put_line(v3_tx);  12  end;  13  / PL/SQL procedure successfully completed. SQL>