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

How to disable a trigger name update_salary?

666


What is a temporal data type?

588


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

1767


What are the events on which a database trigger can be based?

584


Can we rename a column in the output of sql query?

536






What are functions in sql?

500


What is the use of %rowtype?

528


How to find 3rd highest salary of an employee from the employee table in sql?

560


What is the purpose of primary key?

525


What is a system versioned table?

522


Why is a trigger used?

519


Can we perform dml in function?

586


What is difference between left and right outer join?

511


What does the sign mean in sql?

499


What is a clob in sql?

558