Determining if a data is an integer or not?
Is there a way in Oracle SQL that I can look at a position of a column and determine if that data is an integer or not?
The column is defined as a varchar2 and I know I need to subscript into it(second position for 1 byte) but I don't know how to test for 0-9 without coding 0,1,2,3,4,5,6,7,8,9.
The data would look something like "CJE20020" and I want to include data with non-interger values(i.e. include the amount for this activity since the second position is a "J").
I'm just trying to select data where the second position is alphabetical(i.e. a-z)
SELECT ename FROM Emp
WHERE upper(substr(ename,2,1)) BETWEEN chr(65) and chr(90)
- Nandu
Isn't the following variant much more "human"?
A touch of Genius ! jmodic you have ur own ways of refining! :)
- Nandu
Re: Isn't the following variant much more "human"?
Quote:
Originally posted by nandu
A touch of Genius ! jmodic you have ur own ways of refining! :)
- Nandu
DITTO!!!:)
Do you know exactly how to code
Try this way !
SELECT case when UPPER(SUBSTR(ename,2,1)) = '1' then 'Fire'
when UPPER(SUBSTR(ename,2,1)) BETWEEN 'A' and 'M' then 'Water'
when UPPER(SUBSTR(ename,2,1)) BETWEEN 'L' and 'Z' then 'Waste' else 'Unknown' end from emp
HTH
- Nandu