注释可以出现在语句中的任何关键字、参数或标点符号之间。您可以通过两种方式在语句中添加注释:
以两个连字符(—)为开头的注释。符号后跟着注释的文本。此文本不能扩展到新行,并以换行符结束注释。
以下示例展示了多种形式的以斜杠和星号(/*)为开头的注释:
employee_id -- employee id
salary + NVL(commission_pct, 0), -- total compensation
job_id, -- job
departments d
WHERE e.department_id = d.department_id
AND salary + NVL(commission_pct, 0) > -- whose compensation
-- is greater than
FROM employees
WHERE last_name = 'Pataballa') -- of Pataballa
ORDER BY last_name -- and order by last name
employee_id -- and employee id.