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 are sql objects?
what is the difference between a local and a global temporary table? : Sql dba
What is a database? Explain
What is primary key in db?
What is aggregate function in sql?
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?
Why stored procedures are faster than query?
How do I view tables in mysql?
Does inner join return duplicate rows?
what are enums used for in mysql? : Sql dba
What is a procedure in pl sql?
How can you save or place your msg in a table?
What is rename command in sql?
What are variables in pl sql?
Which nosql database is best?