Need Only Numbers [message #320445] |
Thu, 15 May 2008 02:41 |
M.Shakeel Azeem
Messages: 226 Registered: September 2006
|
Senior Member |
|
|
Dear All,
suppose if there's a varchar2 column in which we have saved numbers like '1234' , '23456' ,'213456CR','4535FDR'
now from above example i need only those values which are purely numbers and i want to replace all other values with '0'
how to do it
e.g i need only 1234,1254 and so on
Please help me in this regard.
thanx in advance
|
|
|
|
Re: Need Only Numbers [message #320456 is a reply to message #320445] |
Thu, 15 May 2008 03:12 |
M.Shakeel Azeem
Messages: 226 Registered: September 2006
|
Senior Member |
|
|
ok i understand
let me tell you what i want
i have a table ABC with only one column named as col1 of type varchar2
col1
123
a12
345
ab5
677
i want to update the whole values in col1 which have any character
e.g i want to update values a12,ab5 with 0 without touching the values 123,345,and 677.
will u please give me the example to do it.
thanx a lot for your cooperations
|
|
|
Re: Need Only Numbers [message #320458 is a reply to message #320456] |
Thu, 15 May 2008 03:16 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Have you looked up the syntax and examples in the link that I provided? Make an attempt to solve your problem, post what you did and we will help you to work through it if you do not get it right. But put some effort in and try it for yourself.
|
|
|
|
Re: Need Only Numbers [message #320460 is a reply to message #320456] |
Thu, 15 May 2008 03:21 |
|
Littlefoot
Messages: 21808 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Is this what you want?
UPDATE this_table SET
col1 = 0
WHERE col1 <contains anything but numbers>; If so, <part> might be easily resolved by use of regular expressions.
|
|
|