add comment in materialized view direct format

Viewed 176

I wanted to know if it is possible to place the comment directly in the column of the materialized view definition

(ex: comment '(1)xxxxxxx'--error) or if it should always be done apart from the following way

(ex:(2) comment on column test33.o_rowid is 'is my view column comment')

I saw that in the case of tables if it is possible to put the comment directly.

    create MATERIALIZED view prueba34
as
select 
   o.rowid o_rowid comment '(1)xxxxxxx', -- Error  ,
   c.rowid c_rowid,
   e.rowid e_rowid,
   f.rowid f_rowid,
      nvl(o.estado ||'-'||c.vdescricion,'') as ddesc,
  o.segmento ||'-'|| e.vdescricion as Clase,
   f.vdescricion as v2descripcion
from detalle_ordenes o, tabla_hija c, tabla_hija e,tabla_hija f
where
   ( o.estado=c.vvalor(+) and c.tipo_filtro=1 )
   and
   ( o.segmento=e.vvalor(+) and e.tipo_filtro=2) 
   and 
   ( o.column1=f.vvalor(+) and f.tipo_filtro=3)
   
   (2)comment on column prueba33.o_rowid is 'is my view column comment';
2 Answers

Unfortunately not, and I'm not sure what you mean by "I saw that in the case of tables if it is possible to put the comment directly" ?

To my knowledge, comments are always a separate command, namely:

comment on table XXX is '....';
comment on column XXX.YYY is '....';

You can add comments to the query definition of the materialized view:

CREATE TABLE detalle_ordenes (
  col1 NUMBER
);

CREATE MATERIALIZED VIEW prueba34
AS 
SELECT o.rowid AS o_rowid -- example comment in the mview
  FROM detalle_ordenes o;

They will be stored in the database and visible in the column query of USER_MVIEWS.

In addition to that, you can add comments in the usual way to the container table, as you and Connor described, with COMMENT ON ...

Related