|
|
Archives of the TeradataForum
Message Posted: Thu, 17 Jun 2004 @ 21:15:59 GMT
Subj: | | Re: How to identify number in alphanumerics field? |
|
From: | | Hartman, David L |
One way to do this is to use CASE and SUBSTR logic as shown below to check each byte for numerics (up to the max size of the VARCHAR column)and
TRIM to eliminate blanks.
select
(trim((case when (substr(COLUMN,1,1) between '0' and '9')
then substr(COLUMN,1,1)
else ' '
end) ||
(case when (substr(COLUMN,2,1) between '0' and '9')
then substr(COLUMN,2,1)
else ' '
end))) ||
(trim((case when (substr(COLUMN,3,1) between '0' and '9')
then substr(COLUMN,3,1)
else ' '
end) ||
(case when (substr(COLUMN,4,1) between '0' and '9')
then substr(COLUMN,4,1)
else ' '
end))) ||
..
| |