there are 2 variables called x and y ,x contains 1,2 and y
contains 3,4 we have to swap the values from x to y and y
to x with out using dummy variables and it can be done only
by using a single statement ? how?

Answer Posted / raji_4u

IF YOU WANT TO UPDATE THE TABLE,

UPDATE TABLE_NAME
SET X = Y, Y = X;

--------------------------
IF YOU WANT TO JUST DISPLAY,

SELECT Y X,X Y FROM TABLE_NAME;

ISN'T THIS SIMPLE THAN SANTHI.K DID.

Is This Answer Correct ?    5 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is normalization in sql?

529


Can one improve the performance of sql*loader? : aql loader

587


What are all the different normalizations?

589


How can you get sql*loader to commit only at the end of the load file? : aql loader

554


What is your daily office routine?

1810






Define concurrency control. : Transact sql

587


Define SQL and state the differences between SQL and other conventional programming Languages?

682


when is the use of update_statistics command? : Sql dba

504


Is json a nosql?

541


What is difference between pl and sql?

532


What is integrity in sql?

562


Give the order of sql select?

614


What is bulk compiling in pl/sql.?

610


How do I write a cron which will run a sql query and mail the results to agroup?

527


What is an escape character in sql?

564