1.

Why the EXIT statement used in PL/SQL?

Answer»

Once a value is DECLARED in PL/SQL, you cannot change it. The CONSTANT keyword is used in PL/SQL to DECLARE a constant.

The following is a query to FIND the area of circle, wherein we have SET the constant pi as:

pi constant number := 3.141592654;

Above, we have declared a constant.

Let us see the COMPLETE code:

DECLARE   pi constant number := 3.141592654;   radius number(5,2);     d number(5,2);     area number (10, 2); BEGIN     radius := 3;     d:= radius * 2;     area := pi * radius * radius;   dbms_output.put_line('Radius = ' || radius);   dbms_output.put_line('Diameter = ' || d);   dbms_output.put_line('Area = ' || area); END; /

The output displays the area of circle:

Radius = 3 Diameter = 6 Area = 28.27 Statement processed. 0.01 seconds


Discussion

No Comment Found