Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

extract number from varchar

 
abhijat alok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have a varchar2 primary key col,
with values like like 'EE21','EE22','EE27' etc.
Now the problem is ,how do i perform operations
with the substringed numbers ,ie 21,22,27.
More Specifically ,can i know how to convert
substringed values to integer.
I am using oracle 10g.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dude,

Try with this function to_Number(String, format). This Converts a string to a number using the optional format if specified

Ex : numberData := TO_NUMBER(SUBSTR(stringVal,1,3),'999');

here the param '999' is optional
[ February 21, 2005: Message edited by: Srinivasa Raghavan ]
 
abhijat alok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks srini , thats exactly what i wanted.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic