I have a table with a column city. The values are “delhi” and “hyderabad”. I need to update Hyderabad with delhi and delhi with Hyderabad. Define a query for that

Questions by surender reddy g

Showing Answers 1 - 6 of 6 Answers

you need three update statements for acheiving this task1. update set = 'delhi' where = 'temp' ;commit;2. update set = 'delhi' where = 'hyderabad' ;commit;3. update set = 'hyderabad' where = 'temp' ;commit;Please note that the commit is only a precaution , it can be used only once after all the three DML statements are run.Thank you,Ajay NerumatiOracle DBA

  Was this answer useful?  Yes

jkreddy

  • Feb 4th, 2007
 

Hi its simple update statement.. update column city set city = 'delhi' where city ='hyderabad'this is it simple...bye JK

  Was this answer useful?  Yes

rams

  • Feb 10th, 2007
 

hitry out the following queryupdate tablenameset city=case city when 'delhi' then 'hyderabad' when 'hyderabad' then 'delhi' else city end;

  Was this answer useful?  Yes

P.V.Deshpande

  • Mar 27th, 2007
 

 update table_city  set city = (decode(city,'Delhi', 'Hydrabad','Delhi'))

  Was this answer useful?  Yes

emraan

  • Dec 31st, 2009
 

update e set a = case a when 'city' then 'hyd' when 'hyd' then 'city' end


perfect and tested

Imran Baig
+91 - 9247519684

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions