注释可以出现在语句中的任何关键字、参数或标点符号之间。您可以通过两种方式在语句中添加注释:

    • 以两个连字符(—)为开头的注释。符号后跟着注释的文本。此文本不能扩展到新行,并以换行符结束注释。

    以下示例展示了多种形式的以斜杠和星号(/*)为开头的注释:

    1. employee_id -- employee id
    2. salary + NVL(commission_pct, 0), -- total compensation
    3. job_id, -- job
    4. departments d
    5. WHERE e.department_id = d.department_id
    6. AND salary + NVL(commission_pct, 0) > -- whose compensation
    7. -- is greater than
    8. FROM employees
    9. WHERE last_name = 'Pataballa') -- of Pataballa
    10. ORDER BY last_name -- and order by last name
    11. employee_id -- and employee id.