Database updating sort order central alberta dating sites
How can I achieve the above Thanks Sandra 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.How can I achieve the above Thanks Sandra "order by" is not valid in an update command.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.
With that - returning only one row - why request the min(col2) - since you only have one row ?
Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
now when ever if i add a new entry ...i want to sort it and i want to assign the sorted it for that.
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.