GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 112 of 170    Print  
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

  
Total Answers and Comments: 4 Last Update: March 27, 2007     Asked by: surender reddy g 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 29, 2007 07:23:11   #1  
Ajay Nerumati Member Since: January 2007   Contribution: 3    

RE: I have a table with a column city. The values are...
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
 
Is this answer useful? Yes | No
February 04, 2007 07:16:56   #2  
jkreddy        

RE: I have a table with a column city. The values are...
Hi its simple update statement.. update column city set city = 'delhi' where city ='hyderabad'this is it simple...bye JK
 
Is this answer useful? Yes | No
February 10, 2007 00:58:24   #3  
rams        

RE: I have a table with a column city. The values are...
hitry out the following queryupdate tablenameset city=case city when 'delhi' then 'hyderabad' when 'hyderabad' then 'delhi' else city end;
 
Is this answer useful? Yes | No
March 27, 2007 04:55:09   #4  
P.V.Deshpande        

RE: I have a table with a column city. The values are...
 update table_city  set city = (decode(city,'Delhi', 'Hydrabad','Delhi'))
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape