Reader, May 20, 2001 - 3:48 pm UTC
Helena Markova, May 21, 2001 - 2:41 am UTC
Replace 62 by Length Function
Asif Momen, May 21, 2001 - 2:46 am UTC
Hi Tom,
The SQL is wonderful. But, why to hardcode the statement by '62', instead of that we can read the length of the column eg. Length(x).
select replace(translate( x, translate( x,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rpad( '*', Length(x), '*' ) ), ' ' ), ' ', '')
from t
/
Regards,
Momen.
Special Characters
Mark M, December 18, 2002 - 2:26 pm UTC
Space between characters in a string
Ratan, August 21, 2003 - 3:43 am UTC
Hi,
Need help to write query to get the following.
my input: "Testing"
how to get this Output : " T e s t i n g"
i.e. each character follwed by sapce except last character.
Thanks in advance.
Ratan
ailuro, April 29, 2005 - 3:29 am UTC
SQL> select regexp_replace('Testing','(.)',' \1') PRESPACEDCHARS from dual;
PRESPACEDCHARS
--------------
T e s t i n g
9I solution for insert a Space between characters in a string
Frank Zhou, January 18, 2006 - 5:19 pm UTC
Here is a 9I solution:
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
Frank
what about unicode?
Thomas, September 05, 2006 - 4:48 am UTC
Hi Tom,
his works fine for US-Letters, but how to code this using only unicode chars? To build a string of all valid letters is no option as it is for building a string of all invalid letters - they are just too many.
is there a simple solution (for 9i)?
September 05, 2006 - 5:01 pm UTC
you have to srot of define what are valid "characters" to you - there is no "valid characters" function, no.
10G regular expression solution for the original question
Frank Zhou, January 09, 2007 - 5:23 pm UTC
Here is a 10G solution using regular expression .
Thanks,
Frank
SQL> select str str_old,
2 REGEXP_REPLACE( str, '[^[:alnum:]]' , '') as st_new
3 from t;
STR_OLD ST_NEW
------------------------------ ------------------------------
*sk6789er$2*%%&6 sk6789er26