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

how can I make a script that can be bi-language (supports english, german)? : Sql dba

1010


Are stored procedures compiled?

917


What is audit logout in sql profiler?

1022


define join and explain different type of joins? : Sql dba

950


Why do we create views in sql?

1149


What are the operators used in select statements?

1057


What is the difference between the sql*loader and import utilities? : aql loader

1037


what does myisamchk do? : Sql dba

1010


explain the difference between myisam static and myisam dynamic. : Sql dba

944


What is the starting oracle error number? What is meant by forward declaration in functions?

988


how to select unique records from a table? : Sql dba

1111


What is acid property in a database?

1031


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?

1123


How to place comments in pl/sql?

1151


What is union and union all keyword in sql and what are their differences?

1100