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
What are the types of triggers in sql?
What are different types of functions in sql?
how to enter characters as hex numbers? : Sql dba
how to use case expression? : Sql dba
What is a string data type in sql?
Can we create table in function?
What are all the different types of indexes?
Does postgresql run on the cloud?
how is myisam table stored? : Sql dba
How do I count rows in sql?
Why use triggers in sql?
What problem one might face while writing log information to a data-base table in pl/sql?
What is sql*loader?
How does join work in sql?
Explain the difference between drop and truncate commands in sql?