Example documentationVIEWDEFS Locate this document in the navigation structure

 

Use of the system table DOMAIN.VIEWDEFS

Prerequisites

You can use the demo data for the SQL tutorial. Start the Database Studio as database administrator MONA with the password RED and log on to demo database DEMODB: Logging On to a Database.

Create view tables. Proceed as described in SQL Tutorial, View Tables.

Activities

You can use Database Studio to enter and execute SQL statements. More information: Working with SQL Statements: Overview

Note the General Instructions for formulating SQL statements.

You can use the system table VIEWDEFS to determine the following database information, among other things:

  • SQL statement text used in the view table definition

    SELECT definition

    FROM DOMAIN.VIEWDEFS

    WHERE schemaname = 'HOTEL'

    AND viewname = 'CUSTOMER_ADDR'

  • Length of the view table definition

    SELECT len

    FROM DOMAIN.VIEWDEFS

    WHERE schemaname = 'HOTEL'

    AND viewname = 'CUSTOMER_ADDR'

Only the owner of a view table can select the definition. No output is provided for any other users.

More Information

All view tables: see VIEWS

Existence of a view table: see TABLES

Tables and columns forming the basis for a view table: see VIEWCOLUMNS