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
What are the two characteristics of a primary key?
How many types of cursors supported in pl/sql?
Explain table and field in sql?
What are sql constraints?
What is partition in sql query?
Can a select statement fire a trigger?
How can you maintain the integrity of your database on instances where deleting an element in a table result in the deletion of the element(s) within another table?
What is primary key secondary key alternate key candidate key?
Explain how exception handling is done in advance pl/sql?
How to create your own reports in sql developer?
what are the types of subquery? : Sql dba
Why are sql stored procedures used?
How do you identify a primary key?
How do you copy a table in sql?
What are the triggers associated with image items?