Is this a once off thing:
The first thing that comes into mind is to create a new table (same table
structure) with an additional sequence column.
In an anonymous block you can loop through all the records in a cursor and
insert into the new table ordered correctly (populating the new seq column
with a counter variable or a database sequence).

With that you will be able to then write another anon block to calculate the
new value for your new field and update the record accordingly.

If that is not possible for your situation, I would look into the analytic
sql functions, there may be something you could use similar to RANK, to
'number' your rows.
Hope that helps/or givers you some ideas.

On Fri, Dec 12, 2008 at 1:45 PM, Rem-8 <[email protected]> wrote:

>
> Hello. I'm in the middle of a problem.
> I have many many rows in a table. I need to add another column to it
> which has to be subtract of value A from row N and value B from row
> N-1. For example
>
>                                                         . NEW COLUMN
> 2008-10-10 12:05          223
> 2008-10-10 12:10          226                 3
> 2008-10-10 12:15          238                 12
>
> Etc... How this can be acomplished? Thanks in advance.
>
> >
>


-- 
Michael Mann

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to