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
How to disable a trigger name update_salary?
What is a temporal data type?
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
What are the events on which a database trigger can be based?
Can we rename a column in the output of sql query?
What are functions in sql?
What is the use of %rowtype?
How to find 3rd highest salary of an employee from the employee table in sql?
What is the purpose of primary key?
What is a system versioned table?
Why is a trigger used?
Can we perform dml in function?
What is difference between left and right outer join?
What does the sign mean in sql?
What is a clob in sql?