Write a PL/SQL block to find the square, cube, and double of a number inputted with a substitution variable, and print results using built-in package DBMS_OUTPUT.

What will be an ideal response?


```
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 n NUMBER(2);
3 square NUMBER(3);
4 cube NUMBER(4);
5 double NUMBER(3);
6 BEGIN
7 n := &number;
8 square := n * n;
9 cube := n * n * n;
10 double := n * 2;
11 DBMS_OUTPUT.PUT_LINE('number is ' || n);
12 DBMS_OUTPUT.PUT_LINE('square is ' || square);
13 DBMS_OUTPUT.PUT_LINE('cube is ' || cube);
14 DBMS_OUTPUT.PUT_LINE('double is ' || double);
15 end;
16 /
Enter value for number: 3
old 7: n := &number;
new 7: n := 3;
number is 3
square is 9
cube is 27
double is 6

PL/SQL procedure successfully completed.
```

Computer Science & Information Technology

You might also like to view...

Explain how you might use Outlook to allow a message recipient to vote, such as when you want to poll club members for their preferred speaker for your next event. Describe the steps involved.

What will be an ideal response?

Computer Science & Information Technology

The ________ has the largest capacity of any storage device

A) CD B) mechanical hard drive C) SSD D) DVD

Computer Science & Information Technology

The Report Design window in OpenOffice Base is the window used to create a report

Indicate whether the statement is true or false

Computer Science & Information Technology

The icon identifies ________

A) merged documents B) building blocks C) subdocuments D) combined documents

Computer Science & Information Technology