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 / parivesh sinha

declare
x number:=1;
x1 number:=2;
y number:=3;
y1 number:=4;
begin
x := y1- y;
dbms_output.put_line (x);
x1 := y1+1 - y;
dbms_output.put_line (x1);
y := x +x1;
dbms_output.put_line (y);
y1 := x1+1 +x;
dbms_output.put_line (y1);
end;

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is normalisation in sql?

553


what is the difference between char_length and length? : Sql dba

576


What is anonymous block in sql?

640


What are aggregate functions in sql?

633


What is the difference between stored procedure and view?

534






What is the primary key?

538


what is oltp (online transaction processing)? : Sql dba

537


How do I run a query in pl sql developer?

562


How to convert comma separated string to array in pl/sql?

602


what is a trigger? : Sql dba

580


How can you get sql*loader to commit only at the end of the load file? : aql loader

556


how to shut down the server with 'mysqladmin'? : Sql dba

549


how can you create an empty table from an existing table? : Sql dba

664


What is over () in sql?

531


What is restrict in sql?

561