Write a PL/SQL block to swap the values of two variables. Print variables before and after swapping.
What will be an ideal response?
```
SQL> SET VERIFY OFF
SQL> DECLARE
2 num1 NUMBER(2) := &s_num1;
3 num2 NUMBER(2) := &s_num2;
4 temp NUMBER(2);
5 BEGIN
6 DBMS_OUTPUT.PUT_LINE ('num1=' || num1 || ' and num2=' || num2);
7 temp := num1;
8 num1 := num2;
9 num2 := temp;
10 DBMS_OUTPUT.PUT (‘After swap,’);
11 DBMS_OUTPUT.PUT_LINE ('num1=' || num1 || ' and num2=' || num2);
12 END;
13 /
Enter value for s_num1: 5
Enter value for s_num2: 10
num1=5 and num2=10
After swap, num1=10 and num2=5
PL/SQL procedure successfully completed.
```
You might also like to view...
What are audio samples?
What will be an ideal response?
_________________________ intentionally shrink an image to eliminate overprinting
Fill in the blank(s) with the appropriate word(s).
Passwords provide strong protection.
Answer the following statement true (T) or false (F)
What is the subscriber identity module (SIM)?
What will be an ideal response?