dbTalk Databases Forums  

convert string to int

comp.databases.oracle comp.databases.oracle


Discuss convert string to int in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cindy Lee
 
Posts: n/a

Default convert string to int - 06-22-2004 , 12:34 PM






in my query can I convert a string to int

select convert(int,str_col) from table


I just need the order by, if there's a different way.

select str_col from table order by convert(int,str_col)



Reply With Quote
  #2  
Old   
Romeo Olympia
 
Posts: n/a

Default Re: convert string to int - 06-22-2004 , 08:36 PM






You're looking for the TO_NUMBER() function. You could supply various
format models for this if necessary but the following will get you
going.

select str_col from table order by to_number(str_col);

See the SQL Reference Manual for loads of info
(http://tahiti.oracle.com).

Cheers.

"Cindy Lee" <dangreece (AT) hotmail (DOT) com> wrote

Quote:
in my query can I convert a string to int

select convert(int,str_col) from table


I just need the order by, if there's a different way.

select str_col from table order by convert(int,str_col)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.