Re: Convert Char to Num
Posted in 1997
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Jeff Craig wrote:
>
> Damien wrote:
> }>
> }>
> }>Is there a function to convert a CHAR to a Numeric format ?
> }>I want to make a SUM from a column wich contains some numeric data,
> }>but the type of the column is CHAR and I can't change it.
The engine can perform the automatic conversion just not for a numeric
aggregation function. So:
1) Explicitely create a temp table with an integer, float, or decimal
column.
2) Insert into the temp table, selected the char column from your table.
3) Select SUM() from tmep table:
create temp table fred( summary integer );
insert into fred select numeric_chars from mytable;select sum(summary) from fred;
Art S. Kagel