Subject Re: convert, cast
Author karolbieniaszewski
--- In firebird-support@yahoogroups.com, "Olaf Kluge" <olaf.kluge@...> wrote:
>
> Hello
>
>
>
> I have a litte stored procecure which converts a string into a number:
>
>
>
> CREATE PROCEDURE U_CN_TO_INT (
>
> CN_IN VARCHAR (15))
>
> RETURNS (
>
> INT_OUT INTEGER)
>
> AS
>
> BEGIN
>
> int_out = cast(cn_in as integer);
>
> SUSPEND;
>
> END
>
>
>
> Cf_in is the input string containing the following: 0000001234
>
> I get with the output-variable int_out the number 1234. A other procedure
> converts a string into a floating point 000012345999 into 12345.999 with the
> same problem:
>
>
>
> If the input value is not a string with leading zeros, I get an error.
>
>
>
> How can I check that bevore I cast the value?
>
>
>
> Thank you.
>
>
>
> Best regards
>
>
>
> Olaf
>
>
>
> [Non-text portions of this message have been removed]
>

what error?
and how look this procedure for floating point numbers?