Database updating sort order dating sites for 50 and over

Posted by / 15-Mar-2020 00:05

It appears that what you want to do is to update the row having the lowest value for col2 where col1=0.You could use this: UPDATE MY_TABLE SET col1 = :new Value WHERE col1 = 0 AND col2 = (SELECT MIN(col2) FROM MY_TABLE WHERE col1 = 0); Of course if the table is very large and there is no index on col2, this could be slow. DECLARE CURSOR c IS SELECT col1 FROM my_table WHERE col1 = 0 ORDER BY col2 FOR UPDATE OF col1; r c%ROWTYPE; BEGIN OPEN c; FETCH c INTO r; IF c%FOUND THEN UPDATE my_table SET col1 = :new Value WHERE CURRENT OF c; END IF; CLOSE c; END; An advantage here is that if the min(col2) value is in multiple rows with col1 = 0, the first example will update all of them while the second example will only update one. Hope this helps Ken Denny I am trying to do the following: EXEC SQL UPDATE MY TABLE SET COL1 = :new Value WHERE COL1 = 0 AND ROWNUM = 1 ORDER BY COL2; (index on COL1, COL2) Pro*C does not process the "ORDER BY" statement.That approach results in total queries = total amount of items.This new approach is a significant improvement and has reduced a lot of our large data sets from 40 queries down to three.

* * Copyright (c) 2012 Yannick Albert ( * Licensed under the MIT license (

In many of our applications we support dragging and dropping datasets to change the order.

We save this order in a database column that is an integer and is in sequential order.

That row can be any row within your table - due to the random retreival by Oracle (will probably be the first physical row in the table, most of the time).

With that - returning only one row - why request the min(col2) - since you only have one row ?

database updating sort order-2database updating sort order-34database updating sort order-84

Over the millenia so many changes have been made to the strings that they are no longer in any form of alphabetical order and there are hundreds of them.