sql>DECLARE 2 how many NUMBER; 3 num_tables NUMBER; 4 BEGIN 5 --Begin processing 6 SELECT COUNT(*) INTO how many 7 FROM USER_OBJECTS 8 WHERE OBJECT_TYPE='TABLE'; --Check number of tables 9 num_tables :=how many; --Compute some other values 10 END; 11 / PL/SQL program is successfully executed.
The above example describes the PL/SQL standard program for composing single line comments.
SQL> /* Multiple Comment line1
Multiple Comment line2 */
SQL> DECLARE 2 some_condition BOOLEAN; 3 pi NUMBER:=3.1415936; 4 radius NUMBER:=15; 5 area NUMBER; 6 BEGIN 7 /*Perform some simple tests and assignments*/ 8 IF 2+2=4 THEN 9 some_condition:=TRUE; 10 /* We expect this THEN to always be performed*/ 11 END IF; 12 /* The following line computes the area of a circle using pi, 13 which is the ratio between the circumstance and diameter. 14 After the area is computed,the result is displayed.*/ 15 area:=pi*radius**2; 16 DBMS_OUTPUT.PUT_LINE('The area is:'||TO_CHAR(area)); 17 END; 18 / The area is: 706.858335 PL/SQL procedure is successfully completed.
The above example describes the PL/SQL standard program for composing multiple line comments.