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: How to do this trick ?

Re: How to do this trick ?

From: Nobody <Nobody_at_yahoo.com>
Date: Fri, 15 Oct 1999 13:07:06 +0800
Message-ID: <3806b65c@ruby.hknet.com>


you might try this way:

(1) construct a stored function which returns the highest number less than the current one (for example, get_previous_no)

(2) in your sql, simple select ..

   select mynumber, mynumber - get_previous_no(mynumber) from testing;

hth

Norazman Abu Sahir <norazman_at_ti.com> wrote in message news:38069C25.6FC6948C_at_ti.com...
> Hi,
> I have a table with one colum. When I do a select below are the data.
>
> SQL> SELECT MYNUMBER FROM TESTING;
>
> MYNUMBER
> ----------
> 1
> 3
> 5
> 10
>
> What I would like to do is how to display a different betwen a row value
> with a previous row value.
> Something like this:
>
> MYNUMBER DIFF
> ---------- -------
> 1 0
> 3 2
> 5 2
> 10 5
>
> Have any idea?
> TIA
>
>
Received on Fri Oct 15 1999 - 00:07:06 CDT

Original text of this message

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