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 / senthil kumar
declare
x number:= 1;
y number:= 3;
begin
x := x + y;
dbms_output.put_line (x); -- output 4;
y := x - y;
dbms_output.put_line (y); -- output 1;
x := x - y;
dbms_output.put_line (x); -- output 3;
end;
/
Now Y got 1 and x got 3 samae way of x = 2, y =4
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is mutating trigger?
What are data types in pl sql?
What is the difference between clustered and non-clustered indexes?
What are sql functions? Describe the different types of sql functions?
What is a stored procedure in sql with example?
What is the command used to fetch the first 5 characters of a string?
Does truncate release storage space?
What is snowflake sql?
What packages(if any) has oracle provided for use by developers?
What is the use of double ampersand (&&) in sql queries? Give an example
Does sql between include endpoints?
How many postgresql users are there, worldwide?
How to raise user-defined exception with custom sqlerrm ?
Does pl/sql support create command?
How does pl sql work?