Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: how to retrieve numeric values only from a varchar2?

RE: how to retrieve numeric values only from a varchar2?

From: Ron Thomas <rthomas_at_hypercom.com>
Date: Mon, 07 Oct 2002 09:29:15 -0800
Message-ID: <F001.004E2766.20021007092915@fatcity.com>

You don't need the ltrim if you use

to_char( i, 'FM099')

Ron Thomas
Hypercom, Inc
rthomas_at_hypercom.com
Each new user of a new system uncovers a new class of bugs. -- Kernighan

                                                                                                                           
                      root_at_fatcity.com                                                                                     
                                               To:       ORACLE-L_at_fatcity.com                                              
                      10/07/02 03:38 AM        cc:                                                                         
                      Please respond to        Subject:  RE: how to retrieve numeric values only from a varchar2?          
                      ORACLE-L                                                                                             
                                                                                                                           
                                                                                                                           




I think if you try

ltrim(to_char(i,'099'));

it will remove a leading blank. There is I'm sure a way of doing it explicitly with the format of the to_char but I can't remember what it is.

Iain Nicoll

-----Original Message-----
Sent: Monday, October 07, 2002 10:13 AM
To: Multiple recipients of list ORACLE-L

Hi,

Can anyone point me in the right direction. In my table I have a varchar2 column that contains a label that could be either text or numeric data. I need to update another column in the same table based only on the rows in the first column that are numeric. The values are in the range 001 to 999 only.

I have tried the following piece of pl/sql, unsuccessfully

declare
begin
for i in 1..999
loop
update tdcr set features=db_connect.e_features(132) where label = to_char(i,'099');
end loop;
end;
/

Would anyone be able to tell me where I am going wrong or suggest an efficient piece of sql to perform the task.

TIA

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Nicoll, Iain \(Calanais\)
  INET: iain.nicoll_at_calanais.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Ron Thomas INET: rthomas_at_hypercom.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Mon Oct 07 2002 - 12:29:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US