Friday, November 12, 2010

Oracle - Sorting Alphanumeric values with REGEXP_INSTR

SELECT PRODNAME, CAST(SUBSTR(PRODNAME,REGEXP_INSTR(PRODNAME,'[0-9]'),
LENGTH(PRODNAME) - (REGEXP_INSTR(PRODNAME,'[0-9]') - 1)) AS NUMBER)
AS EXTRACTDIGIT
FROM TEMPALPHANUMERIC
ORDER BY EXTRACTDIGIT


No comments:

Post a Comment