What are the comments in pl/sql
This article mainly explains "what are the notes in pl/sql". The explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the notes in pl/sql".
Comments are divided into single-line comments and multi-line comments.
1. Single-line comments use "-".
DECLARE
Howmany NUMBER
Num_tables NUMBER
BEGIN
-- Begin processing
SELECT COUNT (*) INTO howmany
FROM USER_OBJECTS
WHERE OBJECT_TYPE = 'TABLE';-- Check number of tables
Num_tables: = howmany;-- Compute another value
END
two。 Multiline comments begin with "/ *" and end with "* /".
DECLARE
Some_condition BOOLEAN
Pi NUMBER: = 3.1415926
Radius NUMBER: = 15
Area NUMBER
BEGIN
/ * Perform some simple tests and assignments * /
IF 2 + 2 = 4 THEN
Some_condition: = TRUE
/ * We expect this THEN to always be performed * /
END IF
/ * This line computes the area of a circle using pi
Which is the ratio between the circumference and diameter.
After the area is computed, the result is displayed. , /
Area: = pi * radius**2
DBMS_OUTPUT.PUT_LINE ('The area is:' | | TO_CHAR (area))
END
2. Notes should be paid attention to.
1. Multiline comments cannot be nested, such as the following is wrong:
/ *
IF 2 + 2 = 4 THEN
Some_condition: = TRUE
/ * We expect this THEN to always be performed * /
END IF
, /
two。 Single-line comments can be nested within multiline comments:
/ *
IF 2 + 2 = 4 THEN
Some_condition: = TRUE
-- We expect this THEN to always be performed
END IF
, /
Thank you for your reading, these are the contents of "what are the comments in pl/sql". After the study of this article, I believe you have a deeper understanding of what the comments in pl/sql have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!