Oracle - update , decode and set value

a5ikdqiq

New Member
I have a table e.g. \[code\]**Fruit Number**Apple 5Grape 9Orange 1Coconut 54Mango 22\[/code\]I want to :[*]Select the whole list[*]Put 'Apple, Mango,Coconut' at top of the list. [*]Update the current order, where number = rownum The list should look as follows : \[code\]**Fruit Number**Apple 1Mango 2Coconut 3Grape 4Orange 5\[/code\]I tried the following however getting syntax issues .. \[code\]update tablename set id = rownumwhere fruit in (select fruit from table order by decode(fruit,'Apple',1,'Mango',2,'Coconut',3))\[/code\]
 
Back
Top