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

Home -> Community -> Usenet -> c.d.o.misc -> Re: FOR Next Loop

Re: FOR Next Loop

From: GHouck <hksys_at_teleport.com>
Date: Sat, 28 Aug 1999 12:58:32 -0700
Message-ID: <37C83F68.5AAB@teleport.com>


rodgerdjr_at_my-deja.com wrote:
>
> I am tring to creat a for next loop. I am not
> sure what I am doing wrong.
>
> What I want to do is to strip out all non numbers
> from a field. I thought that I would create a
> For Next loop to accomplish this. this is what I
> have:
>
> LENGTH(STF_STAFF.STF_HOME_PHONE) AS PHONELEN,
> <<PHONELOOP>>
> FOR X = 1 IN PHONELEN LOOP
> TESTSTR = INSTR(STF_STAFF.STF_HOME_PHONE,,X,1)
> TESTANSI = ASCII(TESTSTR)
> IF TESTANSI < 48 THEN
> ELSE
> AA = AA + TESTANSI
> END IF
> IF TESTANSI > 57 THEN
> ELSE
> AA = AA + TESTANSI
> END IF
> END LOOP PHONELOOP
>
> Any help would be greatly appreciated.
>
> Rodger
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

I you are talking Oracle, how about something like:

select
translate(mycolumn,'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789') from mytable

Yours,

Geoff Houck
systems hk
hksys_at_teleport.com
http://www.teleport.com/~hksys Received on Sat Aug 28 1999 - 14:58:32 CDT

Original text of this message

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