Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL command to get data type

Status
Not open for further replies.

delorfra

Programmer
Mar 8, 2001
79
FR
Hi,

I just want to extract part of a column string using substr and then check whether it has a numeric type, how can I do that in Oracle SQL ?

something like :

where IsNumeric(substr(myfield, 4,6))

Thanks.
 
As far as I know there is no built-in function, but you may create your own. If you need to check whether your substring contains only digits the easiest way is to check for ltrim(your_string, '1234567890'), it should be null if your string is number.
If you need to now whether your string is valid number you may
create function IsNumber(pString in varchar2)
return boolean
as
dummy number;
begin
dummy := to_number(pString);
return true;
exception
when value_error then return false;
end;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top