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?

Answers were Sorted based on User's Feedback



there are 2 variables called x and y ,x contains 1,2 and y contains 3,4 we have to swap the values..

Answer / 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

there are 2 variables called x and y ,x contains 1,2 and y contains 3,4 we have to swap the values..

Answer / santhi k

IN ORACLE...

SELECT DECODE(X,X,Y)X,DECODE(Y,Y,X)Y FROM TABLENAME;

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

What is the use of function in sql?

0 Answers  


What is trigger explain it?

0 Answers  


Which is the correct statement about truncate and delete?

0 Answers  


Is it possible to include an insert statement on the same table to which the trigger is assigned?

0 Answers  


How to display all Friday's in a year with date?

4 Answers   Flipkart,






what is a foreign key ? : Sql dba

0 Answers  


What sql does db2 use?

0 Answers  


Is sql a oracle?

0 Answers  


What is package in pl sql with an examples?

0 Answers  


Show how functions and procedures are called in a pl/sql block.

0 Answers  


Can we use views in stored procedure?

0 Answers  


Can we connect to postgresql using sql developer?

0 Answers  


Categories