USE test;
-- Helper table
DROP TABLE IF EXISTS ints;
CREATE TABLE ints (i INT UNSIGNED NOT NULL PRIMARY KEY);
-- make sure you have enough of them
INSERT INTO ints (i) VALUES
( 1), ( 2), ( 3), ( 4), ( 5), ( 6), ( 7), ( 8), ( 9), (10),
(11), (12), (13), (14), (15), (16), (17), (18), (19), (20);
DROP TABLE foo;
CREATE TABLE foo (identification CHAR(20) NOT NULL);
INSERT INTO foo (identification) VALUES
('V-1.234.567'),
('X-ABC-123.9');
SELECT
identification,
GROUP_CONCAT(SUBSTRING(identification, i, 1) ORDER BY i SEPARATOR '')
FROM foo
JOIN ints ON i BETWEEN 1 AND LENGTH(identification)
WHERE
SUBSTRING(identification, i, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
GROUP BY identification;
| Subject | Written By | Posted |
|---|---|---|
| Regexp, replace ??? what do I need to use | Sandra Rascheli | 01/30/2007 10:37AM |
| Re: Regexp, replace ??? what do I need to use | Felix Geerinckx | 01/30/2007 01:40PM |
| Re: Regexp, replace ??? what do I need to use | Sandra Rascheli | 01/30/2007 06:15PM |
| Re: Regexp, replace ??? what do I need to use | Sandra Rascheli | 02/06/2007 10:51AM |
| Re: Regexp, replace ??? what do I need to use | Felix Geerinckx | 02/06/2007 11:56AM |
| Re: Regexp, replace ??? what do I need to use | Sandra Rascheli | 02/06/2007 06:05PM |
| Re: Regexp, replace ??? what do I need to use | Felix Geerinckx | 02/07/2007 02:06AM |
| Re: Regexp, replace ??? what do I need to use | Sandra Rascheli | 02/07/2007 06:02AM |
| Re: Regexp, replace ??? what do I need to use | sumit durugkar | 01/17/2008 01:08AM |
| Re: Regexp, replace ??? what do I need to use | Don Rapp | 01/19/2008 09:57PM |
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.