There is a DB2 view VIEW1. How to get the definition of this view?


To get a DB2 view definition we can use the SYSIBM.SYSVIEW DB2 system table. The SYSVIEW table stores the details about all the views that exist in DB2. We can give below SQL statement to find the view definition.

SELECT NAME, SEQNO, TEXT
   FROM SYSIBM.SYSVIEWS WHERE NAME = ‘VIEW1’
      ORDER BY SEQNO;

The VIEW can have definitions in multiple lines denoted by the SEQNO. That is the reason we need to use ORDER BY SEQNO so as to give the view definition in correct order. The exact definition is available in the TEXT column.

Updated on: 12-Sep-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements