|
|
|
|
Re: How do I find special characters using a regular expresion? [message #190164 is a reply to message #190163] |
Tue, 29 August 2006 08:51 |
Fred Easey
Messages: 73 Registered: January 2005
|
Member |
|
|
I ended up doing this. Does this look right?
drop table fe_special_characters;
create table fe_special_characters
(
why char(1),
ascii_code number(3)
);
DECLARE
strPokerAlias ods.tbl_crypto_accounts.username%TYPE;
i int;
strWhy char(1) := 'X';
strMaster varchar2(100);
/* Cursor declaration: */
CURSOR T1Cursor IS
SELECT
ods.tbl_crypto_accounts.username
FROM
ods.tbl_crypto_accounts
WHERE
username is not null and
REGEXP_INSTR(username,'[^a-z^A-Z^0-9]') > 0;
BEGIN
OPEN T1Cursor;
LOOP
FETCH T1Cursor INTO strPokerAlias;
EXIT WHEN T1Cursor%NOTFOUND;
FOR i in 1..length(strPokerAlias) LOOP
strWhy := substr(strPokerAlias,i,1);
IF REGEXP_INSTR(strWhy,'[^a-z^A-Z^0-9]') > 0
THEN
IF nvl(instr(strMaster,strWhy,1,1),0) = 0
THEN strMaster := strMaster||strWhy;
insert into fe_special_characters values(strWhy,ascii(strWhy));
END IF;
END IF;
END LOOP;
commit;
END LOOP;
CLOSE T1Cursor;
END;
/
select * from fe_special_characters;
[Updated on: Tue, 29 August 2006 08:52] Report message to a moderator
|
|
|