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: spin <ivancrocce_at_gmail.com>
Date: 26 Apr 2007 09:51:39 -0700
Message-ID: <1177606299.865382.43640@s33g2000prh.googlegroups.com>


On 25 abr, 19:23, Rene Nyffenegger <rene.nyffeneg..._at_gmx.ch> wrote:
> On 2007-04-25, cptkirkh <k..._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

  1 select (trunc(3452345)/100-trunc(3452345/100))*100   2* from dual
SQL> / (TRUNC(3452345)/100-TRUNC(3452345/100))*100


                                         45

SQL> Received on Thu Apr 26 2007 - 11:51:39 CDT

Original text of this message

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