pl/sql program to swap two numbers without using third variable
DECLARE
-- declare variable num1, num2
-- of datatype number
num1 NUMBER;
num2 NUMBER;
BEGIN
num1 := 1000;
num2 := 2000;
-- print result before swapping
dbms_output.Put_line('Before');
dbms_output.Put_line('num1 = '
|| num1
||' num2 = '
|| num2);
-- swapping of numbers num1 and num2
num1 := num1 + num2;
num2 := num1 - num2;
num1 := num1 - num2;
-- print result after swapping
dbms_output.Put_line('After');
dbms_output.Put_line('num1 = '
|| num1
||' num2 = '
|| num2);
END;
-- Program End