Re: Character to integer conversion function
Posted in 1996
Arif Ansari (aansari@lstaraxp.tamu.edu) wrote:
: I am a former Oracle person who can't seem to find an INT() function
: that takes a string and give an integer value that you can use within
: an SQL command. (Like an atoi() in C). I'm sure there must be one.
: Any help appreciated
You can write a simple stored procedure that will do this.
create procedure conv_to_int(char_value char(9)) returning integer; define int_value integer;
let int_value = char_value;
return int_value;
end procedure;
and use it in your SQL like this:
select conv_to_int(table.char_value)
from table
You can also write one to perform character to decimal conversions or other
data types.
--
Stefanie Vario
ZenaComp Incorporated
svario@zenacomp.com