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 function and procedure in pl sql?
How do you sort in sql?
Why do we need sharding?
how many sql dml commands are supported by 'mysql'? : Sql dba
Differences between Oracle 9i and 10g (Probably in terms of SQL and PL/SQL)?
How many joins can you have in sql?
what are integrity rules?
What is rename in sql?
What is the purpose of cursors in pl/sql?
How many tables can a sql database have?
What is trigger point?
What are types of exception?
Are left and right joins the same?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
Name some usages of database trigger?