Subject | convert, cast |
---|---|
Author | Olaf Kluge |
Post date | 2011-05-13T20:49:32Z |
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]
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]