Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is program debugging?

1129


Which nosql database is best?

924


What is cold data?

897


Can a table contain multiple foreign key’s?

948


Which is faster truncate or drop?

981


What is the use of index in sql?

958


Can you have a foreign key without a primary key?

900


Explain what is a view?

997


what is the difference between myisam static and myisam dynamic? : Sql dba

1002


How many joins in sql?

945


Can we use pl sql in sql server?

1012


How do you modify a trigger?

875


What is the difference between union and union all command?

1007


How do you remove duplicates without using distinct in sql?

919


What is sequence in sql?

938