-1

I am required to list down all the tables created by view. I know SYSIBM.SYSTABLES will list down all tables, but which field in SYSIBM.SYSTABLES is used to identify that the table is created using view?

Note: I am using DB2 V10.5.

Edit: Reply to @mustaccio, below is the sample of view table.

CREATE OR REPLACE VIEW MYSCHEMA.MYTABLE (
    ...
) AS (
    ...
);
mustaccio
  • 18,234
  • 16
  • 48
  • 57
karfai
  • 816
  • 1
  • 10
  • 21
  • 1
    Can you please clarify what you mean by "table is created using view"? May be provide an example? Both tables and views will be present in `syscat.tables`, where the value in the `type` column would distinguish between tables and views ('T' and 'V' respectively). – mustaccio May 23 '19 at 02:20
  • @mustaccio, thanks. The column "type" is what I need. I edited the post to put an example to create view table. – karfai May 23 '19 at 03:02

1 Answers1

3

Db2 provides documented catalog views. The one for tables is SYSCAT.TABLES. If the TYPE column has a value V, then it is a view.

select tabname,tabschema from syscat.tables
where type='V'
data_henrik
  • 16,724
  • 2
  • 28
  • 49