How to create a comment to an oracle database view

eglobetrotter picture eglobetrotter · May 15, 2012 · Viewed 13.2k times · Source

I would really like to create a comment to a view with a short description of its purpose. Unfortunately it is not possible to create comments to views in oracle. This feature is only for tables, columns and materialized views available. I would like to know how you do describe your database views?

Answer

Raphaël Althaus picture Raphaël Althaus · May 15, 2012

Try:

comment on table <name> is 'text';

The command works on views. For example:

CREATE OR REPLACE VIEW MY_VW AS
  SELECT 1 FROM DUAL;

COMMENT ON TABLE MY_VW IS 'Clever comment.';