How to get view definition from database? (DBMR2327)

~ 0 min
2016-03-18 03:32

There are two SQL statements in DBMaker used to get view definition. One is “def view view_name”, and the other is “select cast (view_definition as char(n)) from sysviewdata where view_name='view_name'”.

For example:

dmSQL> def view V2;

Create view SYSADM.V2 as select C1 from SYSADM.T1 ;

 

dmSQL> select cast(view_definition as char(100)) from sysviewdata where view_name='V2';

 

             CAST(VIEW_DEFINITION AS CHAR(100))

============================================================

create view SYSADM.V2 as select C1 from SYSADM.T1

 

1 rows selected

Note: If the value of n is less than length of view definition statement, users can’t get the whole view definition statement. In this instance, users need to set a larger value for n.

Version: DBMaker4.x/5.x

Product: Normal/Bundle

Platform: Windows/Linux

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags