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 / ravin

Buddies, why are you all selecting from and updating the
tables. The question says, just two variables to be swapped
without using any extra variable and also with a single
statement.
And Ramakanth's answer is right i.e. y=x+y-(x=y) . Thats it.

^^x contains 1,2 - didn't understand though.

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the three forms of normalization?

757


What do you mean by stored procedures?

732


Explain select statements in sql?

759


How do I install sql?

699


What is a table?

728






How to create a menu in sqlplus or pl/sql?

807


When you have to use a default "rollback to" savepoint of plvlog?

912


Explain the significance of the & and && operators in pl sql.

748


How do you modify a column in sql?

730


What is localdb mssqllocaldb?

803


What is a field in a database?

760


How to change the order of columns in Oracle SQL Plus ?

788


How do you explain an index number?

744


What is the difference between Union and Union all. Which is faster.

1062


What are the types of triggers in sql?

698