Use owa_pattern.
See $ORACLE_HOME/rdbms/admin/pubpat.sql
Here's an example:
declare
tstr varchar2(100) := 'this string has 382 embedded numeric data';
begin
dbms_output.put_line( tstr);
-- remove the digits
owa_pattern.change( tstr, '\D', '', 'g');
dbms_output.put_line( tstr);
end;
/
Jared
Robert Morrison <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
10/07/2002 02:13 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
cc:
Subject: how to retrieve numeric values only from a varchar2?
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:
INET: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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).