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 / senthil kumar
declare
x number:= 1;
y number:= 3;
begin
x := x + y;
dbms_output.put_line (x); -- output 4;
y := x - y;
dbms_output.put_line (y); -- output 1;
x := x - y;
dbms_output.put_line (x); -- output 3;
end;
/
Now Y got 1 and x got 3 samae way of x = 2, y =4
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is program debugging?
Which nosql database is best?
What is cold data?
Can a table contain multiple foreign key’s?
Which is faster truncate or drop?
What is the use of index in sql?
Can you have a foreign key without a primary key?
Explain what is a view?
what is the difference between myisam static and myisam dynamic? : Sql dba
How many joins in sql?
Can we use pl sql in sql server?
How do you modify a trigger?
What is the difference between union and union all command?
How do you remove duplicates without using distinct in sql?
What is sequence in sql?