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 / roopesh kumar

declare
x number:= 1;
y number:= 2;
begin
x := x + y;
dbms_output.put_line (x); -- output 3;
y := x - y;
dbms_output.put_line (y); -- output 1;
x := x - y;
dbms_output.put_line (x); -- output 2;
end;
/

Is This Answer Correct ?    8 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of triggers in sql?

1089


What are different types of functions in sql?

1006


how to enter characters as hex numbers? : Sql dba

1045


how to use case expression? : Sql dba

1031


What is a string data type in sql?

1046


Can we create table in function?

968


What are all the different types of indexes?

1150


Does postgresql run on the cloud?

1152


how is myisam table stored? : Sql dba

1059


How do I count rows in sql?

1008


Why use triggers in sql?

961


What problem one might face while writing log information to a data-base table in pl/sql?

1169


What is sql*loader?

1195


How does join work in sql?

1013


Explain the difference between drop and truncate commands in sql?

1056