Str Function

Str Function

Post by José Miguel Giraldez R » Sun, 31 Dec 1899 09:00:00



Hi all:
Would you be kindly to help this newbie to find the informix function, that
converts numeric columns to character type, equivalent to STR?
Thanks
=======================
Jose Miguel Giraldez Rodriguez

 
 
 

Str Function

Post by Art S. Kage » Sun, 31 Dec 1899 09:00:00



Quote:

> Hi all:
> Would you be kindly to help this newbie to find the informix function, that
> converts numeric columns to character type, equivalent to STR?

There is no such function since Informix automatically converts between
text and numeric based on the type of the variable you are fetching the
data into.  Fetch that integer into a string and voila! it's a string.

Art S. Kagel

 
 
 

Str Function

Post by Jose Miguel Giralde » Sun, 31 Dec 1899 09:00:00


What if I need to do something like:
    select * from tableA where numeric_column[1,2]="15"
without using a cursor.

Jos Miguel.



> > Hi all:
> > Would you be kindly to help this newbie to find the informix function, that
> > converts numeric columns to character type, equivalent to STR?

> There is no such function since Informix automatically converts between
> text and numeric based on the type of the variable you are fetching the
> data into.  Fetch that integer into a string and voila! it's a string.

> Art S. Kagel

 
 
 

Str Function

Post by Mark D. Stoc » Sun, 31 Dec 1899 09:00:00



> What if I need to do something like:
>     select * from tableA where numeric_column[1,2]="15"
> without using a cursor.

Try:

        SELECT  col1, col2, col3....., numeric_column||"" char_column
        FROM    tableA
        WHERE   ....
        INTO TEMP tableT
        ;
        SELECT  *
        FROM    tableT
        WHERE   char_column[1,2] = "15"

But the results will depend on your data. You could be looking at tens,
hundreds, thousands, etc...

I hope you know that the data you are looking for is in those two
character positions. It sounds almost like a database design problem to
me.

Cheers,
--
Mark.

+----------------------------------------------------------+-----------+
|Mark D. Stock - Informix SA       http://www.informix.com |////////  /|

|http://www.iiug.org   +-----------------------------------+////  / ///|
| Tel: +27 11 807 0313 |If it's slow, the users complain.  |///  / ////|
| Fax: +27 11 807 2594 |If it's fast, the users keep quiet.|//  / /////|

+----------------------+-----------------------------------+-----------+

 
 
 

1. str function adds a space

Hello there,

I can't figure out why there is a space added in this query result:

SELECT  Isbn + '-' + STR(Specimen) AS IsbnX

suppose Isbn (varchar 20) is "1234567890"
and Specimen (bigint) is 25

the expected result is "1234567890-25"
instead I get "1234567890- 25"

what gives?

2. Alter Table - How do you add identity to an existing column?

3. str() function on NULL values

4. CALL FOR PAPERS

5. Problem in referencing a table as a variable with str function in a statement

6. select count (*) fails

7. str() function and regional settings?

8. TNS-01103 error.

9. Slow query with str function

10. str functions

11. STR Function

12. Int to str function

13. Str with blank spaces from trg to SP???