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

Why coalesce is used in sql?

469


What is the use of non clustered index?

524


What are the different dcl commands in sql?

553


How can we optimize a sql query?

570


What is dml and ddl?

514






What is a join?

617


What are the types of join and explain each?

573


What is type and rowtype in pl sql?

531


what is sql server agent? : Sql dba

599


How is debugging done?

523


Is inner join faster than left join?

625


Is left join inner or outer by default?

521


What is compound trigger?

553


Can we join 3 tables in sql?

488


What are some emotional triggers?

566