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 does the argument [or replace] do?
what is the use of friend function? : Sql dba
What are the most important characteristics of pl/sql?
Explain commit, rollback and savepoint.
explain access control lists. : Sql dba
What does the file extension accdb stand for?
What is procedure function?
Can instead of triggers be used to fire once for each statement on a view?
What do you think about pl/sql?
What are all types of user defined functions?
Is microsoft sql free?
what are the authentication modes in sql server? : Sql dba
What is a sql instance vs database?
How many disk partitions should I have?
What is compound trigger?