From char to int 
Author Message
 From char to int
In a SPL of my IDS 7.23 I try to convert a substring
into an int value.
How can I do it?
I search a kind of Value function like:

define pippo char(50);
define nFirst, nLast, n int;
nFirst = ... expression ...;
nLast = ... expression ...;
n = Value(pippo[nFirst,nLast]);

Thanks a lot.
Miche.



Tue, 22 Jun 2004 19:21:50 GMT
 From char to int

Quote:

>In a SPL of my IDS 7.23 I try to convert a substring
>into an int value.
>How can I do it?
>I search a kind of Value function like:

>define pippo char(50);
>define nFirst, nLast, n int;
>nFirst = ... expression ...;
>nLast = ... expression ...;
>n = Value(pippo[nFirst,nLast]);

SPL should just automagically convert the string to numeric, but it's your
responsibility to be sure that the string you are assigning really looks
like a number, otherwise it might throw some sort of exception.

Sorry for the vagueness of the reply, I don't use SPL much, but the rest of
Informix (SQL, 4GL) does the conversion so SPL can't be any different.

--
Space Corps Directive #997
Work done by an officer's doppleganger in a parallel
universe cannot be claimed as overtime.
    -- Red Dwarf
..  ... .--. .. -  --- -.  --- .-. .- -.-. .-.. .



Tue, 22 Jun 2004 20:54:06 GMT
 From char to int
Let intvar=charvar

loose the value function, if it can be cast then it will be, you could
try

let intvar=charvar::INT

but if it is valid then you will need the 9 engines

Quote:

> In a SPL of my IDS 7.23 I try to convert a substring
> into an int value.
> How can I do it?
> I search a kind of Value function like:

> define pippo char(50);
> define nFirst, nLast, n int;
> nFirst = ... expression ...;
> nLast = ... expression ...;
> n = Value(pippo[nFirst,nLast]);

> Thanks a lot.
> Miche.

--
Paul Watson             #          
Oninit Ltd              # Growing old is mandatory
Tel: +44 1436 672201    # Growing up is optional
Fax: +44 1436 678693    #
www.oninit.com          #


Wed, 23 Jun 2004 03:20:15 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. How to convert from Char to int and discard rows that contain char

2. Convert CHAR to INT and getting result for each record

3. Is there a way of converting char to int on the fly

4. How to Convert char to Int ?

5. SQL: CONVERT char to int with length>4

6. Converting Char to Int before UPDATE

7. libpq: Char to INT

8. convert char to int

9. Checking for type-conversion errors (char to int)

10. Convertion of CHAR to int

11. Converting char to int in INformix SQL

12. Informix column change column type from char to int


 
Powered by phpBB® Forum Software