Tip of the Week
Tip for Week of October 2, 2006

Inserting Spaces

This tip comes from Frank Zhou, a Senior Software Developer in Braintree, MA.

This query inserts a space between characters in a string.

SQL> SELECT MAX(SYS_CONNECT_BY_PATH (ch , ' ')) new_str
2 FROM (
3 SELECT SUBSTR(IN_STR, LEVEL , 1) ch , ROWNUM rn
4 FROM (SELECT 'Testing' AS IN_STR FROM dual)
5 CONNECT BY LEVEL <= LENGTH(IN_STR)
6 )
7 START WITH rn = 1
8 CONNECT BY PRIOR rn = rn -1;

NEW_STR
--------------------------------------------------------------------------------
T e s t i n g

SQL> spool off

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy