Re: Data Conversion in SPL
Posted in 1997
Joerg,
Yes it is possible and is fairly simple (as long as your syntax is correct)
Here is what I would do.
create procedure number_2_string (M_number int) returning char(12);define M_string char(12);
let M_string=M_number;
return M_string;
end procedure
Then to call this procedure just do something like
select number_2_string(interger_column) from table_with_data
The harder thing to do would be to convert the other way because you
would have to determine if you wanted a decimal,float,int etc. and make
sure your string didn't have anything but numbers in it. But that's
another story....HTH
Joe
-------------------------------------------------------------------------
Joseph Cullipher <joseph@cannonexpress.com> Standard Disclaimers Apply
-------------------------------------------------------------------------
On Tue, 28 Oct 1997, Joerg Schneider wrote:
> Hy out there,
>
> is there a possibility to convert data from different types into
> another type (like integer to string) in a stored procedure / trigger ?
>
> I didn't find anything about that in the documentation, but I can't
> imagine
> that there's nothing like that. I tried to convert a integer into char
> but with no
> result. May be there's a implicit or explicit method to use for ???
>
> Any Help would be appreciated (email prefered)
>
> Thanks in Advance
>