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

Home -> Community -> Usenet -> c.d.o.server -> Re: look last two digits

Re: look last two digits

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: Wed, 25 Apr 2007 22:23:11 +0000 (UTC)
Message-ID: <f0okcf$1kk$1@klatschtante.init7.net>


On 2007-04-25, cptkirkh <khill_at_scic.com> wrote:
> If I want to look up the last two digits of a number and I don't know
> how many digits the number is what SQL query can I use? I tried the
> following
>
> select ID from table where substr(id,6) = 30; and it will only work if
> the number of digits is constant. What if I go from a 7 digit number
> to a 6 digit number? Thanks for your help.

SQL> select substr(89094,-2) from dual;

SU

--
94

SQL> select substr(89094.4902,-2) from dual;

SU
--
02


hth,
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch
Received on Wed Apr 25 2007 - 17:23:11 CDT

Original text of this message

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