home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Treasures, Inc.
/
pctreasures.mdf
/
WINDOWS
/
adabas
/
f_0001
/
env
/
xdd.ins
< prev
next >
Wrap
Text File
|
1999-11-01
|
192KB
|
7,826 lines
SAY --- Installing SQL catalog views ...
/* @(#)XDD.ins 10.01.00 1998-01-30
/
INIT SERVERDB
/
IF $RC (EXISTS TABLE DOMAIN.DESIGN) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.DESIGN
(OWNER CHAR(18) ASCII KEY,
NAME CHAR(18) ASCII KEY,
DESC LONG BYTE
)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
GRANT ALL ON DOMAIN.DESIGN TO PUBLIC
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.SYSATTR_TYPE) = 0
THEN
BEGIN
/
DROP TABLE DOMAIN.SYSATTR_TYPE
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.SYSOBJECT_TYPE) = 0
THEN
BEGIN
/
DROP TABLE DOMAIN.SYSOBJECT_TYPE
/
COMMIT WORK
/
END
/
CREATE TABLE DOMAIN.SYSOBJECT_TYPE
(OBJTYPE CHAR(18) ASCII KEY,
OBJNUM FIXED(3,0),
OBJNEW CHAR(1) ASCII,
TABLENAME CHAR(18) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
DESCR_NAME CHAR(60) ASCII,
KIND CHAR(1) ASCII,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
GRANT SELECT ON DOMAIN.SYSOBJECT_TYPE TO PUBLIC
/
DATALOAD TABLE DOMAIN.SYSOBJECT_TYPE
OBJTYPE 1-18
OBJNUM 22-25 DEFAULT NULL
OBJNEW 29-29 DEFAULT NULL
TABLENAME 33-50 DEFAULT NULL
KIND 54-54 DEFAULT NULL
DESCR_NAME 58-117 DEFAULT NULL
INFILE *
NULL '? '
/
COLUMN | 1 | N | COLUMNS | D | Column
CONNECTEDUSER | ? | N | CONNECTEDUSERS | K | Connected User
CONNECTPARAMETER | ? | N | CONNECTPARAMETERS | K | Connect Parameter
CONSTRAINT | 2 | N | CONSTRAINTS | D | Constraint
DBFUNCPARAM | ? | N | DBFUNCPARAMS | I | DB Function Parameter
DBFUNCTION | 11 | N | DBFUNCTIONS | D | DB Function
DBPROCEDURE | 10 | N | DBPROCEDURES | D | DB Procedure
DBPROCPARAM | ? | N | DBPROCPARAMS | I | DB Procedure Parameter
DOMAIN | 8 | Y | DOMAINS | D | Domain
DOMAINCONSTRAINT | ? | N | DOMAINCONSTRAINTS | K | Domain Constraint
EASYCOMMAND | 14 | N | EASYCOMMANDS | K | Easy Command
EASYFORM | 15 | N | EASYFORMS | K | Easy Form
FOREIGNKEY | 3 | N | FOREIGNKEYS | D | Foreign Key
INDEX | 4 | N | INDEXES | D | Index
LITERAL | ? | N | LITERALS | C | Literal
MAPCHARSET | ? | N | MAPCHARSETS | K | Mapchar Set
MODULE | 17 | N | MODULES | C | Module
PROGRAM | 16 | N | PROGRAMS | C | Program
QPCOMMAND | 18 | N | QPCOMMANDS | C | QueryPlus SQL Statement
QPEXCELLINK | 21 | N | QPEXCELLINKS | C | QueryPlus ExcelLink
QPQUERY | 19 | N | QPQUERYS | C | QueryPlus Visual Query
QPWORDLINK | 20 | N | QPWORDLINKS | C | QueryPlus WordLink
QUERYCOMMAND | 13 | N | QUERYCOMMANDS | C | Query Command
SEQUENCE | ? | N | SEQUENCES | K | Sequence
SERVERDB | ? | N | SERVERDBS | K | Serverdb
SNAPSHOT | 12 | Y | SNAPSHOTS | D | Snapshot
SNAPSHOTDEF | ? | N | SNAPSHOTDEFS | K | Snapshot Definition
SYNONYM | 7 | Y | SYNONYMS | D | Synonym
TABLE | 0 | Y | TABLES | D | Table
TERMCHARSET | ? | N | TERMCHARSETS | K | Termchar Set
TRIGGER | 5 | N | TRIGGERS | D | Trigger
TRIGGERPARAM | ? | N | TRIGGERPARAMS | I | Trigger Parameter
USER | 9 | Y | USERS | D | User
VERSION | ? | N | VERSIONS | K | Version
VIEW | 6 | Y | VIEWS | D | View
VIEWDEF | ? | N | VIEWDEFS | K | View Definition
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 8
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.SYSOBJECT_DESC) = 0
THEN
BEGIN
/
DROP TABLE DOMAIN.SYSOBJECT_DESC
/
COMMIT WORK
/
END
/
CREATE TABLE DOMAIN.SYSOBJECT_DESC
(OBJTYPE CHAR(18) ASCII KEY,
COLUMNNAME CHAR(18) ASCII KEY,
COLNUM FIXED(3,0),
COLSEL FIXED(3,0),
DESCR_NAME CHAR(60) ASCII,
TOID CHAR(1) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
GRANT SELECT ON DOMAIN.SYSOBJECT_DESC TO PUBLIC
/
DATALOAD TABLE DOMAIN.SYSOBJECT_DESC
OBJTYPE 1-18
COLUMNNAME 22-39 CHAR
COLNUM 43-46 CHAR
COLSEL 50-53 CHAR
TOID 57-57 DEFAULT NULL
DESCR_NAME 61-120 CHAR
INFILE *
NULL '? '
/
COLUMN | OWNER | 0 | 1 | Y | Owner
COLUMN | TABLENAME | 1 | 2 | Y | Table Name
COLUMN | COLUMNNAME | 2 | 3 | Y | Column Name
COLUMN | MODE | 3 | 0 | N | Mode
COLUMN | DATATYPE | 4 | 0 | N | Data Type
COLUMN | CODETYPE | 5 | 0 | N | Code Type
COLUMN | LEN | 6 | 0 | N | Length
COLUMN | DEC | 7 | 0 | N | Decimals
COLUMN | COLUMNPRIVILEGES | 8 | 0 | N | Privileges
COLUMN | DEFAULT | 9 | 0 | N | Default
COLUMN | DOMAINNAME | 10 | 0 | Y | Domain Name
COLUMN | POS | 11 | 0 | N | Position
COLUMN | KEYPOS | 12 | 0 | N | Key Position
COLUMN | CREATEDATE | 13 | 0 | N | Create Date
COLUMN | CREATETIME | 14 | 0 | N | Create Time
COLUMN | ALTERDATE | 15 | 0 | N | Alter Date
COLUMN | ALTERTIME | 16 | 0 | N | Alter Time
COLUMN | TABLETYPE | 17 | 0 | N | Table Type
COLUMN | COMMENT | 18 | 0 | N | Comment
CONNECTEDUSER | USERNAME | 0 | 1 | Y | User Name
CONNECTEDUSER | TERMID | 1 | 0 | N | Termid
CONNECTEDUSER | SESSION | 2 | 0 | N | Session
CONNECTEDUSER | CATALOG_CACHE_SIZE | 3 | 0 | N | Catalog Cache Size
CONNECTEDUSER | DBPROC_CACHE_SIZE | 4 | 0 | N | DB Procedure Cache Size
CONNECTEDUSER | TEMP_CACHE_SIZE | 5 | 0 | N | Temp Cache Size
CONNECTEDUSER | SERVERDB | 6 | 0 | Y | Serverdb
CONNECTPARAMETER | SQLMODE | 0 | 0 | N | SQL Mode
CONNECTPARAMETER | ISOLEVEL | 1 | 0 | N | Isolation Level
CONNECTPARAMETER | TIMEOUT | 2 | 0 | N | Timeout
CONNECTPARAMETER | CACHELIMIT | 3 | 0 | N | Cachelimit
CONNECTPARAMETER | TERMCHARSETNAME | 4 | 0 | Y | Termchar Set Name
CONSTRAINT | OWNER | 0 | 1 | Y | Owner
CONSTRAINT | TABLENAME | 1 | 2 | Y | Table Name
CONSTRAINT | CONSTRAINTNAME | 2 | 3 | Y | Constraint Name
CONSTRAINT | DEFINITION | 3 | 0 | N | Definition
DBFUNCPARAM | OWNER | 0 | 1 | Y | Owner
DBFUNCPARAM | DBFUNCNAME | 1 | 2 | Y | DB Function Name
DBFUNCPARAM | PARAMETERNAME | 2 | 3 | Y | Parameter Name
DBFUNCPARAM | POS | 3 | 0 | N | Position
DBFUNCPARAM | IN/OUT-TYPE | 4 | 0 | N | In/Out-Type
DBFUNCPARAM | DATATYPE | 5 | 0 | N | Data Type
DBFUNCPARAM | LEN | 6 | 0 | N | Length
DBFUNCPARAM | DEC | 7 | 0 | N | Decimals
DBFUNCPARAM | CREATEDATE | 8 | 0 | N | Create Date
DBFUNCPARAM | CREATETIME | 9 | 0 | N | Create Time
DBFUNCTION | OWNER | 0 | 1 | Y | Owner
DBFUNCTION | DBFUNCNAME | 1 | 2 | N | DB Function Name
DBFUNCTION | CREATEDATE | 2 | 0 | N | Create Date
DBFUNCTION | CREATETIME | 3 | 0 | N | Create Time
DBFUNCTION | COMMENT | 4 | 0 | N | Comment
DBPROCEDURE | OWNER | 0 | 1 | Y | Owner
DBPROCEDURE | PROGRAMNAME | 1 | 2 | N | Program Name
DBPROCEDURE | DBPROCNAME | 2 | 3 | N | DB Procedure Name
DBPROCEDURE | ALIASNAME | 3 | 0 | N | Alias Name
DBPROCEDURE | PARAMETER | 4 | 0 | N | Parameter
DBPROCEDURE | EXECUTABLE | 5 | 0 | N | Executable
DBPROCEDURE | GRANT | 6 | 0 | N | Grant
DBPROCEDURE | CREATEDATE | 7 | 0 | N | Create Date
DBPROCEDURE | CREATETIME | 8 | 0 | N | Create Time
DBPROCEDURE | COMMENT | 9 | 0 | N | Comment
DBPROCPARAM | OWNER | 0 | 1 | Y | Owner
DBPROCPARAM | PROGRAMNAME | 1 | 2 | Y | Program Name
DBPROCPARAM | DBPROCNAME | 2 | 3 | Y | DB Procedure Name
DBPROCPARAM | PARAMETERNAME | 3 | 4 | Y | Parameter Name
DBPROCPARAM | POS | 4 | 0 | N | Position
DBPROCPARAM | IN/OUT-TYPE | 5 | 0 | N | In/Out-Type
DBPROCPARAM | DATATYPE | 6 | 0 | N | Data Type
DBPROCPARAM | LEN | 7 | 0 | N | Length
DBPROCPARAM | DEC | 8 | 0 | N | Decimals
DBPROCPARAM | CREATEDATE | 9 | 0 | N | Create Date
DBPROCPARAM | CREATETIME | 10 | 0 | N | Create Time
DOMAINCONSTRAINT | OWNER | 0 | 1 | Y | Owner
DOMAINCONSTRAINT | DOMAINNAME | 1 | 2 | Y | Domain Name
DOMAINCONSTRAINT | CONSTRAINTNAME | 2 | 3 | Y | Constraint Name
DOMAINCONSTRAINT | DEFINITION | 3 | 0 | N | Definition
DOMAIN | OWNER | 0 | 1 | Y | Owner
DOMAIN | DOMAINNAME | 1 | 2 | Y | Domain Name
DOMAIN | DATATYPE | 2 | 0 | N | Data Type
DOMAIN | CODETYPE | 3 | 0 | N | Code Type
DOMAIN | LEN | 4 | 0 | N | Length
DOMAIN | DEC | 5 | 0 | N | Decimals
DOMAIN | DEFAULT | 6 | 0 | N | Default
DOMAIN | DEFINITION | 7 | 0 | N | Definition
DOMAIN | CREATEDATE | 8 | 0 | N | Create Date
DOMAIN | CREATETIME | 9 | 0 | N | Create Time
DOMAIN | COMMENT | 10 | 0 | N | Comment
EASYCOMMAND | OWNER | 0 | 1 | Y | Owner
EASYCOMMAND | COMMANDNAME | 1 | 2 | Y | Commmand Name
EASYCOMMAND | TABLEOWNER | 2 | 0 | Y | Table Owner
EASYCOMMAND | TABLENAME | 3 | 0 | Y | Table Name
EASYCOMMAND | CREATEDATE | 4 | 0 | N | Create Date
EASYCOMMAND | CREATETIME | 5 | 0 | N | Create Time
EASYCOMMAND | ALTERDATE | 6 | 0 | N | Alter Date
EASYCOMMAND | ALTERTIME | 7 | 0 | N | Alter Time
EASYCOMMAND | COMMENT | 8 | 0 | N | Comment
EASYFORM | OWNER | 0 | 1 | Y | Owner
EASYFORM | TABLENAME | 1 | 2 | Y | Table Name
EASYFORM | FORMNAME | 2 | 3 | Y | Form Name
EASYFORM | CREATEDATE | 3 | 0 | N | Create Date
EASYFORM | CREATETIME | 4 | 0 | N | Create Time
EASYFORM | ALTERDATE | 5 | 0 | N | Alter Date
EASYFORM | ALTERTIME | 6 | 0 | N | Alter Time
EASYFORM | COMMENT | 7 | 0 | N | Comment
FOREIGNKEY | OWNER | 0 | 1 | Y | Owner
FOREIGNKEY | TABLENAME | 1 | 2 | Y | Table Name
FOREIGNKEY | FKEYNAME | 2 | 3 | Y | Foreign Key Name
FOREIGNKEY | RULE | 3 | 0 | N | Rule
FOREIGNKEY | CREATEDATE | 4 | 0 | N | Create Date
FOREIGNKEY | CREATETIME | 5 | 0 | N | Create Time
FOREIGNKEY | COMMENT | 6 | 0 | N | Comment
INDEX | OWNER | 0 | 1 | Y | Owner
INDEX | TABLENAME | 1 | 2 | Y | Table Name
INDEX | INDEXNAME | 2 | 3 | Y | Index Name
INDEX | TYPE | 3 | 0 | N | Type
INDEX | CREATEDATE | 4 | 0 | N | Create Date
INDEX | CREATETIME | 5 | 0 | N | Create Time
INDEX | COMMENT | 6 | 0 | N | Comment
LITERAL | OWNER | 0 | 1 | Y | Owner
LITERAL | LITERALNAME | 1 | 2 | N | Literal Name
LITERAL | LANGUAGE | 2 | 3 | N | Language
LITERAL | S_LABEL | 3 | 0 | N | Small Lable
LITERAL | M_LABEL | 4 | 0 | N | Medium Label
LITERAL | L_LABEL | 5 | 0 | N | Large Label
LITERAL | XL_LABEL | 6 | 0 | N | Extra Large Label
LITERAL | CREATEDATE | 7 | 0 | N | Create Date
LITERAL | CREATETIME | 8 | 0 | N | Create Time
LITERAL | ALTERDATE | 9 | 0 | N | Alter Date
LITERAL | ALTERTIME | 10 | 0 | N | Alter Time
LITERAL | COMMENT | 11 | 0 | N | Comment
MAPCHARSET | MAPCHARSETNAME | 0 | 1 | Y | Mapchar Set Name
MAPCHARSET | CODE | 1 | 0 | N | Code
MAPCHARSET | INTERN | 2 | 0 | N | Intern
MAPCHARSET | MAP_CODE | 3 | 0 | N | Map Code
MAPCHARSET | MAP_CHARACTER | 4 | 0 | N | Map Character
MODULE | OWNER | 0 | 1 | Y | Owner
MODULE | PROGRAMNAME | 1 | 2 | N | Program Name
MODULE | MODULENAME | 2 | 3 | N | Module Name
MODULE | PROGLANG | 3 | 0 | N | Program Language
MODULE | CREATEDATE | 4 | 0 | N | Create Date
MODULE | CREATETIME | 5 | 0 | N | Create Time
MODULE | ALTERDATE | 6 | 0 | N | Alter Date
MODULE | ALTERTIME | 7 | 0 | N | Alter Time
MODULE | COMMENT | 8 | 0 | N | Comment
PROGRAM | OWNER | 0 | 1 | Y | Owner
PROGRAM | PROGRAMNAME | 1 | 2 | N | Program Name
PROGRAM | PROGLANG | 2 | 3 | N | Program Language
PROGRAM | CREATEDATE | 3 | 0 | N | Create Date
PROGRAM | CREATETIME | 4 | 0 | N | Create Time
PROGRAM | ALTERDATE | 5 | 0 | N | Alter Date
PROGRAM | ALTERTIME | 6 | 0 | N | Alter Time
PROGRAM | COMMENT | 7 | 0 | N | Comment
QPCOMMAND | OWNER | 0 | 1 | Y | Owner
QPCOMMAND | COMMANDNAME | 1 | 2 | N | Command Name
QPCOMMAND | CREATEDATE | 2 | 0 | N | Create Date
QPCOMMAND | CREATETIME | 3 | 0 | N | Create Time
QPCOMMAND | ALTERDATE | 4 | 0 | N | Alter Date
QPCOMMAND | ALTERTIME | 5 | 0 | N | Alter Time
QPCOMMAND | COMMENT | 6 | 0 | N | Comment
QPEXCELLINK | OWNER | 0 | 1 | Y | Owner
QPEXCELLINK | EXCELLINKNAME | 1 | 2 | N | ExcelLink Name
QPEXCELLINK | CREATEDATE | 2 | 0 | N | Create Date
QPEXCELLINK | CREATETIME | 3 | 0 | N | Create Time
QPEXCELLINK | ALTERDATE | 4 | 0 | N | Alter Date
QPEXCELLINK | ALTERTIME | 5 | 0 | N | Alter Time
QPEXCELLINK | COMMENT | 6 | 0 | N | Comment
QPQUERY | OWNER | 0 | 1 | Y | Owner
QPQUERY | QUERYNAME | 1 | 2 | N | Query Name
QPQUERY | CREATEDATE | 2 | 0 | N | Create Date
QPQUERY | CREATETIME | 3 | 0 | N | Create Time
QPQUERY | ALTERDATE | 4 | 0 | N | Alter Date
QPQUERY | ALTERTIME | 5 | 0 | N | Alter Time
QPQUERY | COMMENT | 6 | 0 | N | Comment
QPWORDLINK | OWNER | 0 | 1 | Y | Owner
QPWORDLINK | WORDLINKNAME | 1 | 2 | N | WordLink Name
QPWORDLINK | CREATEDATE | 2 | 0 | N | Create Date
QPWORDLINK | CREATETIME | 3 | 0 | N | Create Time
QPWORDLINK | ALTERDATE | 4 | 0 | N | Alter Date
QPWORDLINK | ALTERTIME | 5 | 0 | N | Alter Time
QPWORDLINK | COMMENT | 6 | 0 | N | Comment
QUERYCOMMAND | OWNER | 0 | 1 | Y | Owner
QUERYCOMMAND | COMMANDNAME | 1 | 2 | Y | Command Name
QUERYCOMMAND | CREATEDATE | 2 | 0 | N | Create Date
QUERYCOMMAND | CREATETIME | 3 | 0 | N | Create Time
QUERYCOMMAND | ALTERDATE | 4 | 0 | N | Alter Date
QUERYCOMMAND | ALTERTIME | 5 | 0 | N | Alter Time
QUERYCOMMAND | COMMENT | 6 | 0 | N | Comment
SEQUENCE | OWNER | 0 | 1 | Y | Owner
SEQUENCE | SEQUENCE_NAME | 1 | 2 | Y | Sequence Name
SEQUENCE | MIN_VALUE | 2 | 0 | N | Min Value
SEQUENCE | MAX_VALUE | 3 | 0 | N | Max Value
SEQUENCE | INCREMENT_BY | 4 | 0 | N | Increment By
SEQUENCE | CYCLE_FLAG | 5 | 0 | N | Cycle Flag
SEQUENCE | ORDER_FLAG | 6 | 0 | N | Order Flag
SEQUENCE | CACHE_SIZE | 7 | 0 | N | Cache Size
SEQUENCE | LAST_NUMBER | 8 | 0 | N | Last Number
SEQUENCE | CREATEDATE | 9 | 0 | N | Create Date
SEQUENCE | CREATETIME | 10 | 0 | N | Create Time
SEQUENCE | COMMENT | 11 | 0 | N | Comment
SERVERDB | NO | 0 | 0 | N | No
SERVERDB | STATE | 1 | 0 | N | State
SERVERDB | MAJORITY | 2 | 0 | N | Majority
SERVERDB | SERVERDB | 3 | 0 | Y | Serverdb
SERVERDB | SERVERNODE | 4 | 0 | Y | Servernode
SNAPSHOTDEF | OWNER | 0 | 1 | Y | Owner
SNAPSHOTDEF | SNAPSHOTNAME | 1 | 2 | Y | Snapshot Name
SNAPSHOTDEF | FAST_REFRESHABLE | 2 | 0 | N | Fast Refreshable
SNAPSHOTDEF | MASTER_OWNER | 3 | 0 | Y | Master Owner
SNAPSHOTDEF | MASTER_TABLENAME | 4 | 0 | Y | Master Table Name
SNAPSHOTDEF | LEN | 2 | 0 | N | Length
SNAPSHOTDEF | DEFINITION | 3 | 0 | N | Definition
SNAPSHOT | OWNER | 0 | 1 | Y | Owner
SNAPSHOT | SNAPSHOTNAME | 1 | 2 | Y | Snapshot Name
SNAPSHOT | PRIVILEGES | 2 | 0 | N | Privileges
SNAPSHOT | TYPE | 3 | 0 | N | Type
SNAPSHOT | CREATEDATE | 4 | 0 | N | Create Date
SNAPSHOT | CREATETIME | 5 | 0 | N | Create Time
SNAPSHOT | UPDSTATDATE | 6 | 0 | N | Update Statistics Date
SNAPSHOT | UPDSTATTIME | 7 | 0 | N | Update Statistics Time
SNAPSHOT | ALTERDATE | 8 | 0 | N | Alter Date
SNAPSHOT | ALTERTIME | 9 | 0 | N | Alter Time
SNAPSHOT | REPLICATION | 10 | 0 | N | Replication
SNAPSHOT | SERVERDB | 11 | 0 | Y | Serverdb
SNAPSHOT | SERVERNODE | 12 | 0 | Y | Servernode
SNAPSHOT | UNLOADED | 13 | 0 | N | Unloaded
SNAPSHOT | COMMENT | 14 | 0 | N | Comment
SYNONYM | OWNER | 0 | 1 | Y | Owner
SYNONYM | SYNONYMNAME | 1 | 2 | Y | Synonym Name
SYNONYM | TABLEOWNER | 2 | 0 | Y | Table Owner
SYNONYM | TABLENAME | 3 | 0 | Y | Table Name
SYNONYM | CREATEDATE | 4 | 0 | N | Create Date
SYNONYM | CREATETIME | 5 | 0 | N | Create Time
SYNONYM | COMMENT | 6 | 0 | N | Comment
TABLE | OWNER | 0 | 1 | Y | Owner
TABLE | TABLENAME | 1 | 2 | Y | Table Name
TABLE | PRIVILEGES | 2 | 0 | N | Privileges
TABLE | TYPE | 3 | 0 | N | Type
TABLE | CREATEDATE | 4 | 0 | N | Create Date
TABLE | CREATETIME | 5 | 0 | N | Create Time
TABLE | UPDSTATDATE | 6 | 0 | N | Update Statistics Date
TABLE | UPDSTATTIME | 7 | 0 | N | Update Statistics Time
TABLE | ALTERDATE | 8 | 0 | N | Alter Date
TABLE | ALTERTIME | 9 | 0 | N | Alter Time
TABLE | REPLICATION | 10 | 0 | N | Replication
TABLE | SERVERDB | 11 | 0 | Y | Serverdb
TABLE | SERVERNODE | 12 | 0 | Y | Servernode
TABLE | SNAPSHOT_LOG | 13 | 0 | N | Snapshot Log
TABLE | UNLOADED | 15 | 0 | N | Unloaded
TABLE | COMMENT | 14 | 0 | N | Comment
TERMCHARSET | TERMCHARSETNAME | 0 | 1 | Y | Termchar Set Name
TERMCHARSET | CODE | 1 | 0 | N | Code
TERMCHARSET | STATE | 2 | 0 | N | State
TERMCHARSET | INTERN | 3 | 0 | N | Intern
TERMCHARSET | EXTERN | 4 | 0 | N | Extern
TERMCHARSET | COMMENT | 5 | 0 | N | Comment
TRIGGERPARAM | OWNER | 0 | 1 | Y | Owner
TRIGGERPARAM | TABLENAME | 1 | 2 | Y | Table Name
TRIGGERPARAM | TRIGGERNAME | 2 | 3 | Y | Trigger Name
TRIGGERPARAM | PARAMETERNAME | 3 | 4 | Y | Parameter Name
TRIGGERPARAM | POS | 4 | 0 | N | Position
TRIGGERPARAM | NEW/OLD-TYPE | 5 | 0 | N | New/Olt-Type
TRIGGERPARAM | DATATYPE | 6 | 0 | N | Data Type
TRIGGERPARAM | LEN | 7 | 0 | N | Length
TRIGGERPARAM | DEC | 8 | 0 | N | Decimals
TRIGGERPARAM | CREATEDATE | 9 | 0 | N | Create Date
TRIGGERPARAM | CREATETIME | 10 | 0 | N | Create Time
TRIGGER | OWNER | 0 | 1 | Y | Owner
TRIGGER | TABLENAME | 1 | 2 | Y | Table Name
TRIGGER | TRIGGERNAME | 2 | 3 | Y | Trigger Name
TRIGGER | INSERT | 3 | 0 | N | Insert
TRIGGER | UPDATE | 4 | 0 | N | Update
TRIGGER | DELETE | 5 | 0 | N | Delete
TRIGGER | CREATEDATE | 6 | 0 | N | Create Date
TRIGGER | CREATETIME | 7 | 0 | N | Create Time
TRIGGER | DEFINITION | 8 | 0 | N | Definition
TRIGGER | COMMENT | 9 | 0 | N | Comment
USER | OWNER | 0 | 1 | Y | Owner
USER | GROUPNAME | 1 | 2 | Y | Group Name
USER | USERNAME | 2 | 3 | Y | User Name
USER | USERMODE | 3 | 0 | N | User Mode
USER | CONNECTMODE | 4 | 0 | N | Connect Mode
USER | PERMLIMIT | 5 | 0 | N | Permlimit
USER | TEMPLIMIT | 6 | 0 | N | Templimit
USER | MAXTIMEOUT | 7 | 0 | N | Max Timeout
USER | COSTWARNING | 8 | 0 | N | Costwarning
USER | COSTLIMIT | 9 | 0 | N | Costlimit
USER | CACHELIMIT | 10 | 0 | N | Cachelimit
USER | CREATEDATE | 11 | 0 | N | Create Date
USER | CREATETIME | 12 | 0 | N | Create Time
USER | ALTERDATE | 13 | 0 | N | Alter Date
USER | ALTERTIME | 14 | 0 | N | Alter Time
USER | PWCREADATE | 15 | 0 | N | Password Create Date
USER | PWCREATIME | 16 | 0 | N | Password Create Time
USER | SERVERDB | 17 | 0 | Y | Serverdb
USER | SERVERNODE | 18 | 0 | Y | Servernode
USER | COMMENT | 19 | 0 | N | Comment
VERSION | KERNEL | 0 | 0 | N | Kernel
VERSION | RUNTIMEENVIRONMENT | 1 | 0 | N | Runtime Environment
VIEWDEF | OWNER | 0 | 1 | Y | Owner
VIEWDEF | VIEWNAME | 1 | 2 | Y | View Name
VIEWDEF | LEN | 2 | 0 | N | Length
VIEWDEF | DEFINITION | 3 | 0 | N | Definition
VIEW | OWNER | 0 | 1 | Y | Owner
VIEW | VIEWNAME | 1 | 2 | Y | View Name
VIEW | PRIVILEGES | 2 | 0 | N | Privileges
VIEW | TYPE | 3 | 0 | N | Type
VIEW | CREATEDATE | 4 | 0 | N | Create Date
VIEW | CREATETIME | 5 | 0 | N | Create Time
VIEW | UPDSTATDATE | 6 | 0 | N | Update Statistics Date
VIEW | UPDSTATTIME | 7 | 0 | N | Update Statistics Time
VIEW | ALTERDATE | 8 | 0 | N | Alter Date
VIEW | ALTERTIME | 9 | 0 | N | Alter Time
VIEW | REPLICATION | 10 | 0 | N | Replication
VIEW | SERVERDB | 11 | 0 | Y | Serverdb
VIEW | SERVERNODE | 12 | 0 | Y | Servernode
VIEW | UNLOADED | 13 | 0 | N | Unloaded
VIEW | COMMENT | 14 | 0 | N | Comment
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 8
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.SYSRELSHIP_TYPE) = 0
THEN
BEGIN
/
DROP TABLE DOMAIN.SYSRELSHIP_TYPE
/
COMMIT WORK
/
END
/
CREATE TABLE DOMAIN.SYSRELSHIP_TYPE
(RELSHIP_NAME CHAR(18) ASCII KEY,
DEFOBJ_NAME CHAR(18) ASCII,
REFOBJ_NAME CHAR(18) ASCII,
REL_TYPE CHAR(18) ASCII,
DESCR_NAME CHAR(60) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
KIND CHAR(1) ASCII,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
GRANT SELECT ON DOMAIN.SYSRELSHIP_TYPE TO PUBLIC
/
DATALOAD TABLE DOMAIN.SYSRELSHIP_TYPE
RELSHIP_NAME 1-18
DEFOBJ_NAME 22-39 DEFAULT NULL
REFOBJ_NAME 43-60 DEFAULT NULL
REL_TYPE 64-81 DEFAULT NULL
KIND 85-85 DEFAULT NULL
DESCR_NAME 89-148 DEFAULT NULL
INFILE *
NULL '? '
/
| COLUMN | COLUMN | USED BY | K | Column - Uses - Column
COL_REFS_DOM | COLUMN | DOMAIN | REFERS | K | Column - Refers to - Domain
COL_USES_COL | COLUMN | COLUMN | USES | K | Column - Uses - Column
DBF_CONT_PRM | DBFUNCTION | DBFUNCPARAM | CONTAINS | I | DB Function - Contains - Parameter
DBF_REFS_MOD | DBFUNCTION | MODULE | REFERS | K | DB Function - Refers to - Module
DBP_CONT_PRM | DBPROCEDURE | DBPROCPARAM | CONTAINS | I | DB Procedure - Contains - Parameter
DBP_REFS_MOD | DBPROCEDURE | MODULE | REFERS | K | DB Procedure - Refers to - Module
ECM_USES_COL | EASYCOMMAND | COLUMN | USES | I | Easy Command - Uses - Column
ECM_USES_SNP | EASYCOMMAND | SNAPSHOT | USES | I | Easy Command - Uses - Snapshot
ECM_USES_SYN | EASYCOMMAND | SYNONYM | USES | I | Easy Command - Uses - Synonym
ECM_USES_TAB | EASYCOMMAND | TABLE | USES | I | Easy Command - Uses - Table
ECM_USES_VIE | EASYCOMMAND | VIEW | USES | I | Easy Command - Uses - View
EFM_USES_COL | EASYFORM | COLUMN | USES | I | Easy Form - Uses - Column
EFM_USES_SNP | EASYFORM | SNAPSHOT | USES | I | Easy Form - Uses - Snapshot
EFM_USES_SYN | EASYFORM | SYNONYM | USES | I | Easy Form - Uses - Synonym
EFM_USES_TAB | EASYFORM | TABLE | USES | I | Easy Form - Uses - Table
EFM_USES_VIE | EASYFORM | VIEW | USES | I | Easy Form - Uses - View
FKC_REFS_COL | FOREIGNKEYCOLUMN | COLUMN | REFERS | I | Foreign Key Column - Refers to - Column
FOK_REFS_TAB | FOREIGNKEY | TABLE | REFERS | K | Foreign Key - Refers to - Table
FOK_USES_COL | FOREIGNKEY | COLUMN | USES | K | Foreign Key - Uses - Column
IND_USES_COL | INDEX | COLUMN | USES | K | Index - Uses - Column
MOD_CALL_DBP | MODULE | DBPROCEDURE | CALLS | C | Module - Calls - DB Procedure
MOD_CALL_MOD | MODULE | MODULE | CALLS | C | Module - Calls - Module
MOD_USES_COL | MODULE | COLUMN | USES | C | Module - Uses - Column
MOD_USES_DOM | MODULE | DOMAIN | USES | C | Module - Uses - Domain
MOD_USES_QCM | MODULE | QUERYCOMMAND | USES | C | Module - Uses - Query Command
MOD_USES_SNP | MODULE | SNAPSHOT | USES | K | Module - Uses - Snapshot
MOD_USES_SYN | MODULE | SYNONYM | USES | K | Module - Uses - Synonym
MOD_USES_TAB | MODULE | TABLE | USES | C | Module - Uses - Table
MOD_USES_VIE | MODULE | VIEW | USES | K | Module - Uses - View
PRO_CONT_MOD | PROGRAM | MODULE | CONTAINS | K | Program - Contains - Module
QCM_USES_COL | QUERYCOMMAND | COLUMN | USES | C | Query Command - Uses - Column
QCM_USES_SNP | QUERYCOMMAND | SNAPSHOT | USES | K | Query Command - Uses - Snapshot
QCM_USES_SYN | QUERYCOMMAND | SYNONYM | USES | K | Query Command - Uses - Synonym
QCM_USES_TAB | QUERYCOMMAND | TABLE | USES | C | Query Command - Uses - Table
QCM_USES_VIE | QUERYCOMMAND | VIEW | USES | K | Query Command - Uses - View
QPC_USES_COL | QPCOMMAND | COLUMN | USES | C | QueryPlus SQL Statement - Uses - Column
QPC_USES_SNP | QPCOMMAND | SNAPSHOT | USES | K | QueryPlus SQL Statement - Uses - Snapshot
QPC_USES_SYN | QPCOMMAND | SYNONYM | USES | K | QueryPlus SQL Statement - Uses - Synonym
QPC_USES_TAB | QPCOMMAND | TABLE | USES | C | QueryPlus SQL Statement - Uses - Table
QPC_USES_VIE | QPCOMMAND | VIEW | USES | K | QueryPlus SQL Statement - Uses - View
QPE_USES_QPC | QPEXCELLINK | QPCOMMAND | USES | C | QueryPlus ExcelLink - Uses - QueryPlus SQL Statement
QPE_USES_QPQ | QPEXCELLINK | QPQUERY | USES | C | QueryPlus ExcelLink - Uses - QueryPlus Visual Query
QPQ_USES_COL | QPQUERY | COLUMN | USES | C | QueryPlus Visual Query - Uses - Column
QPQ_USES_SNP | QPQUERY | SNAPSHOT | USES | K | QueryPlus Visual Query - Uses - Snapshot
QPQ_USES_SYN | QPQUERY | SYNONYM | USES | K | QueryPlus Visual Query - Uses - Synonym
QPQ_USES_TAB | QPQUERY | TABLE | USES | C | QueryPlus Visual Query - Uses - Table
QPQ_USES_VIE | QPQUERY | VIEW | USES | K | QueryPlus Visual Query - Uses - View
QPW_USES_QPC | QPWORDLINK | QPCOMMAND | USES | C | QueryPlus WordLink - Uses - QueryPlus SQL Statement
QPW_USES_QPQ | QPWORDLINK | QPQUERY | USES | C | QueryPlus WordLink - Uses - QueryPlus Visual Query
SNP_CONT_COL | SNAPSHOT | COLUMN | CONTAINS | K | Snapshot - Contains - Column
SNP_USES_SYN | SNAPSHOT | SYNONYM | USES | K | Snapshot - Uses - Synonym
SNP_USES_TAB | SNAPSHOT | TABLE | USES | K | Snapshot - Uses - Table
SNP_USES_VIE | SNAPSHOT | VIEW | USES | K | Snapshot - Uses - View
SYN_REFS_SNP | SYNONYM | SNAPSHOT | REFERS | K | Synonym - Refers to - Snapshot
SYN_REFS_TAB | SYNONYM | TABLE | REFERS | K | Synonym - Refers to - Table
SYN_REFS_VIE | SYNONYM | VIEW | REFERS | K | Synonym - Refers to - View
TAB_CONT_COL | TABLE | COLUMN | CONTAINS | K | Table - Contains - Column
TAB_CONT_FOK | TABLE | FOREIGNKEY | CONTAINS | K | Table - Contains - Foreign Key
TAB_CONT_IND | TABLE | INDEX | CONTAINS | K | Table - Contains - Index
TAB_CONT_TRG | TABLE | TRIGGER | CONTAINS | K | Table - Contains - Trigger
TAB_USES_CON | TABLE | CONSTRAINT | USES | K | Table - Uses - Constraint
TRG_CONT_PRM | TRIGGER | TRIGGERPARAM | CONTAINS | I | Trigger - Contains - Parameter
TRG_REFS_MOD | TRIGGER | MODULE | REFERS | K | Trigger - Refers to - Module
USR_OWNS_DBF | USER | DBFUNCTION | OWNS | K | User - Owns - DB Function
USR_OWNS_DOM | USER | DOMAIN | OWNS | K | User - Owns - Domain
USR_OWNS_USR | USER | USER | OWNS | K | User - Owns - User
USR_USES_COL | USER | COLUMN | USES | K | User - Uses - Column
USR_USES_DBP | USER | DBPROCEDURE | USES | K | User - Uses - DB Procedure
USR_USES_PRO | USER | PROGRAM | USES | C | User - Uses - Program
USR_USES_QCM | USER | QUERYCOMMAND | USES | C | User - Uses - Query Command
USR_USES_QPC | USER | QPCOMMAND | USES | C | User - Uses - QueryPlus SQL Statement
USR_USES_QPE | USER | QPEXCELLINK | USES | C | User - Uses - QueryPlus ExcelLink
USR_USES_QPQ | USER | QPQUERY | USES | C | User - Uses - QueryPlus Visual Query
USR_USES_QPW | USER | QPWORDLINK | USES | C | User - Uses - QueryPlus WordLink
USR_USES_SNP | USER | SNAPSHOT | USES | K | User - Uses - Snapshot
USR_USES_TAB | USER | TABLE | USES | K | User - Uses - Table
USR_USES_VIE | USER | VIEW | USES | K | User - Uses - View
VIE_CONT_COL | VIEW | COLUMN | CONTAINS | K | View - Contains - Column
VIE_USES_SNP | VIEW | SNAPSHOT | USES | K | View - Uses - Snapshot
VIE_USES_SYN | VIEW | SYNONYM | USES | K | View - Uses - Synonym
VIE_USES_TAB | VIEW | TABLE | USES | K | View - Uses - Table
VIE_USES_VIE | VIEW | VIEW | USES | K | View - Uses - View
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 8
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.SYSRELATION_TYPE) = 0
THEN
BEGIN
/
DROP TABLE DOMAIN.SYSRELATION_TYPE
/
COMMIT WORK
/
END
/
CREATE TABLE DOMAIN.SYSRELATION_TYPE
(RELATION_TYPE CHAR(18) ASCII KEY,
DESCR_NAME CHAR(40) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
DATALOAD TABLE DOMAIN.SYSRELATION_TYPE
RELATION_TYPE 1-18
INFILE *
DEC '/,/./'
DATE 'YY-MM-DD'
TIME 'HH:MM:SS'
NULL '? '
/
CALLS |
CONTAINS |
OWNS |
REFERS |
USES |
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 8
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.COLUMNS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.COLUMNS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.COLUMNS
(OWNER,TABLENAME,COLUMNNAME,MODE,DATATYPE,CODETYPE,LEN,"DEC",
COLUMNPRIVILEGES,"DEFAULT",DOMAINNAME,POS,KEYPOS,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,TABLETYPE,COMMENT)
AS SELECT
OWNER,TABLENAME,COLUMNNAME,MOD,DATATYPE,CODE,LEN,DEC,
COLUMNPRIVILEGES,"DEFAULT",DOMAINNAME,COLUMNNO,KEYCOLUMNNO,
"DATE","TIME",ALTERDATE,ALTERTIME,TYPE,COMMENT
FROM SYSDD.COLUMNS
WHERE type IN('TABLE','RESULT','SYNONYM','SNAPSHOT','VIEW','SYSTEM')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.COLUMNS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.COLUMN_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'COLUMN',OWNER,TABLENAME,COLUMNNAME,' ',' ',' ',COMMENT
FROM DOMAIN.COLUMNS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.CONNECTPARAMETERS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.CONNECTPARAMETERS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.CONNECTPARAMETERS
AS SELECT *
FROM SYSDD.CONNECTPARAMETERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.CONNECTPARAMETERS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.CONSTRAINTS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.CONSTRAINTS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.CONSTRAINTS
(OWNER,TABLENAME,CONSTRAINTNAME,DEFINITION)
AS SELECT
OWNER,TABLENAME,CONSTRAINTNAME,DEFINITION
FROM SYSDD.CONSTRAINTS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.CONSTRAINTS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBPROCEDURES) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBPROCEDURES
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBPROCEDURES
(OWNER,PROGRAMNAME,DBPROCNAME,ALIASNAME,PARAMETER,
EXECUTABLE,GRANT,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,PROGRAM,MODULE,DBPROCEDURE,PARAMETER,
EXECUTABLE,GRANT,"DATE","TIME",COMMENT
FROM SYSDD.DBPROCEDURES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBPROCEDURES TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.DBPROCEDURE_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'DBPROCEDURE',OWNER,PROGRAMNAME,DBPROCNAME,' ',' ',' ',COMMENT
FROM DOMAIN.DBPROCEDURES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.DBPROCPARAMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBPROCPARAMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBPROCPARAMS
(OWNER,PROGRAMNAME,DBPROCNAME,PARAMETERNAME,POS,"IN/OUT-TYPE",
DATATYPE,LEN,"DEC",CREATEDATE,CREATETIME)
AS SELECT
OWNER,PROGRAM,MODULE,PARAMETERNAME,PARAM_NO,"IN/OUT-TYPE",
DECODE(DATATYPE,'BYTE','CHAR BYTE',DATATYPE),LEN,DEC,"DATE","TIME"
FROM SYSDD.DBPROCPARAMETERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBPROCPARAMS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBFUNCTIONS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBFUNCTIONS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBFUNCTIONS
(OWNER,DBFUNCNAME,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,DBFUNCTION,"DATE","TIME",COMMENT
FROM SYSDD.DBFUNCTIONS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBFUNCTIONS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.DBFUNCTION_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'DBFUNCTION',OWNER,DBFUNCNAME,' ',' ',' ',' ',COMMENT
FROM DOMAIN.DBFUNCTIONS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.DBFUNCPARAMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBFUNCPARAMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBFUNCPARAMS
(OWNER,DBFUNCNAME,PARAMETERNAME,POS,"IN/OUT-TYPE",
DATATYPE,LEN,"DEC",CREATEDATE,CREATETIME)
AS SELECT
OWNER,DBFUNCTION,PARAMETERNAME,PARAM_NO,"IN/OUT-TYPE",
DECODE(DATATYPE,'BYTE','CHAR BYTE',DATATYPE),LEN,DEC,"DATE","TIME"
FROM SYSDD.DBFUNCTIONPARAMS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBFUNCPARAMS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DOMAINS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DOMAINS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DOMAINS
(OWNER,DOMAINNAME,DATATYPE,CODETYPE,LEN,"DEC",
"DEFAULT",DEFINITION,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,DOMAINNAME,DATATYPE,CODE,LEN,DEC,
"DEFAULT",DEFINITION,"DATE","TIME",COMMENT
FROM SYSDD.DOMAINS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DOMAINS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.DOMAIN_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'DOMAIN',OWNER,DOMAINNAME,' ',' ',' ',' ',COMMENT
FROM DOMAIN.DOMAINS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.DOMAINCONSTRAINTS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DOMAINCONSTRAINTS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DOMAINCONSTRAINTS
(OWNER,DOMAINNAME,CONSTRAINTNAME,DEFINITION)
AS SELECT
OWNER,DOMAINNAME,CONSTRAINTNAME,DEFINITION
FROM SYSDD.DOMAIN_CONSTRAINTS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DOMAINCONSTRAINTS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.EASYCOMMAND) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.EASYCOMMAND
(
AUTHNAME CHAR(18) ASCII KEY DEFAULT USERGROUP,
COMMAND_NAME CHAR(18) ASCII KEY DEFAULT ' ',
TOWNER CHAR(18) ASCII KEY DEFAULT ' ',
TNAME CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'EASYCOMMAND',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.EASYCOMMAND_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EASYCOMMAND_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EASYCOMMAND_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,AUTHNAME,COMMAND_NAME,TOWNER,TNAME,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.EASYCOMMAND
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.EASYCOMMANDS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EASYCOMMANDS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EASYCOMMANDS
(OWNER,COMMANDNAME,TABLEOWNER,TABLENAME,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
AUTHNAME,COMMAND_NAME,TOWNER,TNAME,
CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.EASYCOMMAND
WHERE authname = USERGROUP
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EASYCOMMANDS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.EASYFORM) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.EASYFORM
(
TABLEOWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
TABLENAME CHAR(18) ASCII KEY DEFAULT ' ',
FORMOWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
FORMNAME CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'EASYFORM',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.EASYFORM_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EASYFORM_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EASYFORM_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,TABLEOWNER,TABLENAME,FORMOWNER,FORMNAME,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.EASYFORM
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.EASYFORMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EASYFORMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EASYFORMS
(OWNER,TABLENAME,FORMNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
TABLEOWNER,TABLENAME,FORMNAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.EASYFORM
WHERE formowner = USERGROUP
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EASYFORMS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.FOREIGNKEY) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.FOREIGNKEY
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.FOREIGNKEY
(OWNER,TABLENAME,FKEYNAME,RULE,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,TABLENAME,REFNAME,RULE,"DATE","TIME",COMMENT
FROM SYSDD.FOREIGN_KEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE VIEW DOMAIN.FOREIGNKEYS
AS SELECT DISTINCT *
FROM DOMAIN.FOREIGNKEY
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
GRANT SELECT ON DOMAIN.FOREIGNKEYS TO PUBLIC WITH GRANT OPTION
/
COMMIT WORK
/
CREATE VIEW DOMAIN.FOREIGNKEY_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'FOREIGNKEY',OWNER,TABLENAME,FKEYNAME,' ',' ',' ',COMMENT
FROM DOMAIN.FOREIGNKEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.INDEXES) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.INDEXES
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.INDEXES
(OWNER,TABLENAME,INDEXNAME,
TYPE,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,TABLENAME,DECODE(INDEXNAME,' ',COLUMNNAME,INDEXNAME),
TYPE,"DATE","TIME",COMMENT
FROM SYSDD.INDEXES
WHERE columnno = 1
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.INDEXES TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.INDEX_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'INDEX',OWNER,TABLENAME,INDEXNAME,' ',' ',' ',COMMENT
FROM DOMAIN.INDEXES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.LITERAL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.LITERAL
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
LITERALNAME CHAR(18) ASCII KEY DEFAULT ' ',
LANGUAGE CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'LITERAL',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
S_LABEL CHAR(8) ASCII DEFAULT ' ',
M_LABEL CHAR(12) ASCII DEFAULT ' ',
L_LABEL CHAR(18) ASCII DEFAULT ' ',
XL_LABEL CHAR(80) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.LITERAL_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.LITERAL_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.LITERAL_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,LITERALNAME,LANGUAGE,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.LITERAL
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.LITERALS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.LITERALS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.LITERALS
(OWNER,LITERALNAME,LANGUAGE,S_LABEL,M_LABEL,L_LABEL,XL_LABEL,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,LITERALNAME,LANGUAGE,S_LABEL,M_LABEL,L_LABEL,XL_LABEL,
CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.LITERAL
WHERE owner IN(USERGROUP,'PUBLIC')
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.LITERALS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MAPCHARSETS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MAPCHARSETS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MAPCHARSETS
(MAPCHARSETNAME,CODE,INTERN,MAP_CODE,MAP_CHARACTER)
AS SELECT
MAPCHARSETNAME,CODE,INTERN,"MAP CODE","MAP CHARACTER"
FROM SYSDD.MAPCHARSETS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MAPCHARSETS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MODULE) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.MODULE
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
MODULENAME1 CHAR(18) ASCII KEY DEFAULT ' ',
MODULENAME2 CHAR(18) ASCII KEY DEFAULT ' ',
PROGLANG CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'MODULE',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
TYPE CHAR(18) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MODULE_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MODULE_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MODULE_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,MODULENAME1,MODULENAME2,PROGLANG,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.MODULE
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_PRO) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_PRO
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'PROGRAM',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE COPY',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_PRO
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_PRO
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_PRO) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_PRO
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_PRO
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFPROGLANG,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME3,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_PRO
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_PRO TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MODULES) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MODULES
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MODULES
(OWNER,PROGRAMNAME,MODULENAME,PROGLANG,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,MODULENAME1,MODULENAME2,PROGLANG,
CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.MODULE
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.MODULENAME1,T1.MODULENAME2,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.MODULE T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.modulename1 = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.MODULENAME1,T1.MODULENAME2,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.MODULE T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.modulename1 = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.MODULENAME1,T1.MODULENAME2,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.MODULE T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.modulename1 = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.MODULE T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.modulename1 = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defgroupname = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MODULES TO PUBLIC WITH GRANT OPTION
/
IF $RC (SELECT tablename FROM sysdd.views
WHERE owner = 'DOMAIN' AND tablename = 'PROGRAM') = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.PROGRAM
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.PROGRAM) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.PROGRAM
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
PROGRAMNAME CHAR(18) ASCII KEY DEFAULT ' ',
PROGLANG CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'PROGRAM',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.PROGRAM_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.PROGRAM_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.PROGRAM_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,PROGRAMNAME,PROGLANG,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.PROGRAM
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.PROGRAMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.PROGRAMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.PROGRAMS
(OWNER,PROGRAMNAME,PROGLANG,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,PROGRAMNAME,PROGLANG,
CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.PROGRAM
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.PROGRAMNAME,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.PROGRAM T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.programname = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.PROGRAMNAME,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.PROGRAM T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.programname = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.PROGRAMNAME,T1.PROGLANG,
T1.CREATEDATE,T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.PROGRAM T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.programname = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.PROGRAM T1,DOMAIN.USR_USES_PRO T2
WHERE T1.owner = T2.refowner
AND T1.programname = T2.refprogramname
AND T1.proglang = T2.refproglang
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.PROGRAMS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPCOMMAND) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.QPCOMMAND
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
COMMANDNAME CHAR(150) ASCII KEY DEFAULT ' ',
NAME2 CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'QPCOMMAND',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPCOMMAND_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPCOMMAND_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPCOMMAND_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,COMMANDNAME,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.QPCOMMAND
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_QPC) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_QPC
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPCOMMAND',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_QPC
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_QPC
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#USR_USES_QPC COLUMN DEFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_QPC) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_QPC
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_QPC
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFCOMMANDNAME,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,SUBSTR(DEFOBJNAME1,1,18),RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_QPC
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_QPC TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPCOMMANDS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPCOMMANDS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPCOMMANDS
(OWNER,COMMANDNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,COMMANDNAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.QPCOMMAND
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.COMMANDNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPCOMMAND T1,DOMAIN.USR_USES_QPC T2
WHERE T1.owner = T2.refowner
AND T1.commandname = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.COMMANDNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPCOMMAND T1,DOMAIN.USR_USES_QPC T2
WHERE T1.owner = T2.refowner
AND T1.commandname = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.COMMANDNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPCOMMAND T1,DOMAIN.USR_USES_QPC T2
WHERE T1.owner = T2.refowner
AND T1.commandname = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.QPCOMMAND T1,DOMAIN.USR_USES_QPC T2
WHERE T1.owner = T2.refowner
AND T1.commandname = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPCOMMANDS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPEXCELLINK) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.QPEXCELLINK
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
EXCELLINKNAME CHAR(150) ASCII KEY DEFAULT ' ',
NAME2 CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'QPEXCELLINK',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPEXCELLINK_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPEXCELLINK_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPEXCELLINK_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,EXCELLINKNAME,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.QPEXCELLINK
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_QPE) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_QPE
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPEXCELLINK',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_QPE
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_QPE
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#USR_USES_QPE COLUMN DEFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_QPE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_QPE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_QPE
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFEXCELLINKNAME,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,SUBSTR(DEFOBJNAME1,1,18),RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_QPE
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_QPE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPEXCELLINKS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPEXCELLINKS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPEXCELLINKS
(OWNER,EXCELLINKNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,EXCELLINKNAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.QPEXCELLINK
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.EXCELLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPEXCELLINK T1,DOMAIN.USR_USES_QPE T2
WHERE T1.owner = T2.refowner
AND T1.excellinkname = T2.refexcellinkname
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.EXCELLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPEXCELLINK T1,DOMAIN.USR_USES_QPE T2
WHERE T1.owner = T2.refowner
AND T1.excellinkname = T2.refexcellinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.EXCELLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPEXCELLINK T1,DOMAIN.USR_USES_QPE T2
WHERE T1.owner = T2.refowner
AND T1.excellinkname = T2.refexcellinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.QPEXCELLINK T1,DOMAIN.USR_USES_QPE T2
WHERE T1.owner = T2.refowner
AND T1.excellinkname = T2.refexcellinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPEXCELLINKS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPQUERY) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.QPQUERY
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
QUERYNAME CHAR(150) ASCII KEY DEFAULT ' ',
NAME2 CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'QPQUERY',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPQUERY_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQUERY_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQUERY_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,QUERYNAME,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.QPQUERY
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_QPQ) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_QPQ
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPQUERY',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_QPQ
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_QPQ
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#USR_USES_QPQ COLUMN DEFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_QPQ) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_QPQ
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_QPQ
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFQUERYNAME,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,SUBSTR(DEFOBJNAME1,1,18),RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_QPQ
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_QPQ TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPQUERYS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQUERYS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQUERYS
(OWNER,QUERYNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,QUERYNAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.QPQUERY
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.QUERYNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPQUERY T1,DOMAIN.USR_USES_QPQ T2
WHERE T1.owner = T2.refowner
AND T1.queryname = T2.refqueryname
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.QUERYNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPQUERY T1,DOMAIN.USR_USES_QPQ T2
WHERE T1.owner = T2.refowner
AND T1.queryname = T2.refqueryname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.QUERYNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPQUERY T1,DOMAIN.USR_USES_QPQ T2
WHERE T1.owner = T2.refowner
AND T1.queryname = T2.refqueryname
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.QPQUERY T1,DOMAIN.USR_USES_QPQ T2
WHERE T1.owner = T2.refowner
AND T1.queryname = T2.refqueryname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQUERYS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPWORDLINK) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.QPWORDLINK
(
OWNER CHAR(18) ASCII KEY DEFAULT USERGROUP,
WORDLINKNAME CHAR(150) ASCII KEY DEFAULT ' ',
NAME2 CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'QPWORDLINK',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPWORDLINK_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPWORDLINK_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPWORDLINK_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,OWNER,WORDLINKNAME,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.QPWORDLINK
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_QPW) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_QPW
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPWORDLINK',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_QPW
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_QPW
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#USR_USES_QPW COLUMN DEFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_QPW) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_QPW
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_QPW
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFWORDLINKNAME,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,SUBSTR(DEFOBJNAME1,1,18),RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_QPW
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_QPW TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPWORDLINKS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPWORDLINKS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPWORDLINKS
(OWNER,WORDLINKNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS SELECT
OWNER,WORDLINKNAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.QPWORDLINK
WHERE owner = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.WORDLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPWORDLINK T1,DOMAIN.USR_USES_QPW T2
WHERE T1.owner = T2.refowner
AND T1.wordlinkname = T2.refwordlinkname
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.OWNER,T1.WORDLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPWORDLINK T1,DOMAIN.USR_USES_QPW T2
WHERE T1.owner = T2.refowner
AND T1.wordlinkname = T2.refwordlinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.OWNER,T1.WORDLINKNAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QPWORDLINK T1,DOMAIN.USR_USES_QPW T2
WHERE T1.owner = T2.refowner
AND T1.wordlinkname = T2.refwordlinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.OWNER
FROM DOMAIN.QPWORDLINK T1,DOMAIN.USR_USES_QPW T2
WHERE T1.owner = T2.refowner
AND T1.wordlinkname = T2.refwordlinkname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPWORDLINKS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QUERYCOMMAND) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.QUERYCOMMAND
(
AUTHNAME CHAR(18) ASCII KEY DEFAULT USERGROUP,
COMMAND_NAME CHAR(18) ASCII KEY DEFAULT ' ',
NAME2 CHAR(18) ASCII KEY DEFAULT ' ',
NAME3 CHAR(18) ASCII KEY DEFAULT ' ',
OBJTYPE CHAR(18) ASCII KEY DEFAULT 'QUERYCOMMAND',
SUBTYPE CHAR(12) ASCII KEY DEFAULT ' ',
VERSION CHAR(4) ASCII KEY DEFAULT ' ',
LONGNAME CHAR(40) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME,
UPDDATE DATE DEFAULT DATE,
UPDTIME TIME DEFAULT TIME,
COMMENT CHAR(2000) ASCII
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QUERYCOMMAND_) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QUERYCOMMAND_
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QUERYCOMMAND_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME)
AS SELECT
OBJTYPE,AUTHNAME,COMMAND_NAME,NAME2,NAME3,
SUBTYPE,VERSION,COMMENT,UPDDATE,UPDTIME
FROM DOMAIN.QUERYCOMMAND
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.#USR_USES_QCM) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#USR_USES_QCM
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'USER',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QUERYCOMMAND',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
PRIVILEGES CHAR(30) ASCII DEFAULT 'EXECUTE COPY',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#USR_USES_QCM
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#USR_USES_QCM
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_QCM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_QCM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_QCM
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFCOMMANDNAME,
PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME2,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,
PRIVILEGES,CREATEDATE,CREATETIME
FROM DOMAIN.#USR_USES_QCM
WHERE defobjname1 IN(USERGROUP,'PUBLIC')
OR USERGROUP IN(defobjname2,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_QCM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QUERYCOMMANDS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QUERYCOMMANDS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QUERYCOMMANDS
(OWNER,COMMANDNAME,CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,COMMENT)
AS
SELECT
AUTHNAME,COMMAND_NAME,CREATEDATE,CREATETIME,UPDDATE,UPDTIME,COMMENT
FROM DOMAIN.QUERYCOMMAND
WHERE authname = USERGROUP
UNION ALL
SELECT T1.AUTHNAME,T1.COMMAND_NAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QUERYCOMMAND T1,DOMAIN.USR_USES_QCM T2
WHERE T1.authname = T2.refowner
AND T1.command_name = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defgroupname = USERGROUP
UNION ALL
SELECT T1.AUTHNAME,T1.COMMAND_NAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QUERYCOMMAND T1,DOMAIN.USR_USES_QCM T2
WHERE T1.authname = T2.refowner
AND T1.command_name = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC'
UNION ALL
SELECT T1.AUTHNAME,T1.COMMAND_NAME,T1.CREATEDATE,
T1.CREATETIME,T1.UPDDATE,T1.UPDTIME,T1.COMMENT
FROM DOMAIN.QUERYCOMMAND T1,DOMAIN.USR_USES_QCM T2
WHERE T1.authname = T2.refowner
AND T1.command_name = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = USERGROUP
AND NOT EXISTS (SELECT T1.AUTHNAME
FROM DOMAIN.QUERYCOMMAND T1,DOMAIN.USR_USES_QCM T2
WHERE T1.authname = T2.refowner
AND T1.command_name = T2.refcommandname
AND T2.refowner <> USERGROUP
AND T2.defusername = 'PUBLIC')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QUERYCOMMANDS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SEQUENCES) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SEQUENCES
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SEQUENCES
(OWNER,SEQUENCE_NAME,MIN_VALUE,MAX_VALUE,INCREMENT_BY,CYCLE_FLAG,
ORDER_FLAG,CACHE_SIZE,LAST_NUMBER,CREATEDATE,CREATETIME,COMMENT)
AS SELECT
OWNER,SEQUENCE_NAME,MIN_VALUE,MAX_VALUE,INCREMENT_BY,CYCLE_FLAG,
ORDER_FLAG,CACHE_SIZE,LAST_NUMBER,"DATE","TIME",COMMENT
FROM SYSDD.SEQUENCES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SEQUENCES TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.SEQUENCE_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'SEQUENCE',OWNER,SEQUENCE_NAME,' ',' ',' ',' ',COMMENT
FROM DOMAIN.SEQUENCES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.SERVERDBS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SERVERDBS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SERVERDBS
AS SELECT *
FROM SYSDD.SERVERDBS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SERVERDBS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNAPSHOTS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNAPSHOTS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNAPSHOTS
(OWNER,SNAPSHOTNAME,PRIVILEGES,TYPE,CREATEDATE,CREATETIME,
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
REPLICATION,SERVERDB,SERVERNODE,UNLOADED,COMMENT)
AS SELECT
OWNER,TABLENAME,PRIVILEGES,TYPE,"DATE","TIME",
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
DECODE(REPLICATION,'NONE','NO','UNKNOWN',NULL,'YES'),
SERVERDB,SERVERNODE,UNLOADED,COMMENT
FROM SYSDD.TABLES
WHERE type = 'SNAPSHOT'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNAPSHOTS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNAPSHOTDEFS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNAPSHOTDEFS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNAPSHOTDEFS
(OWNER,SNAPSHOTNAME,FAST_REFRESHABLE,MASTER_OWNER,MASTER_TABLENAME,LEN,DEFINITION)
AS SELECT
OWNER,TABLENAME,FAST_REFRESHABLE,MASTER_OWNER,MASTER_TABLENAME,LEN,DEFINITION
FROM SYSDD.SNAPSHOTS
WHERE owner = USERGROUP
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNAPSHOTDEFS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SYNONYMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SYNONYMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SYNONYMS
(OWNER,SYNONYMNAME,TABLEOWNER,TABLENAME,
CREATEDATE,CREATETIME,COMMENT)
AS SELECT
USERGROUP,S.SYNONYMNAME,S.OWNER,S.TABLENAME,
S."DATE",S."TIME",T.COMMENT
FROM SYSDD.TABLES T, SYSDD.SYNONYMS S
WHERE T.owner = USERGROUP
AND T.tablename = S.synonymname
AND T.type = 'SYNONYM'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SYNONYMS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.SYNONYM_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'SYNONYM',OWNER,SYNONYMNAME,' ',' ',' ',' ',COMMENT
FROM DOMAIN.SYNONYMS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.TABLES) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TABLES
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TABLES
(OWNER,TABLENAME,PRIVILEGES,TYPE,CREATEDATE,CREATETIME,
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
REPLICATION,SERVERDB,SERVERNODE,SNAPSHOT_LOG,UNLOADED,COMMENT)
AS SELECT
OWNER,TABLENAME,PRIVILEGES,TYPE,"DATE","TIME",
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
DECODE(REPLICATION,'NONE','NO','UNKNOWN',NULL,'YES'),
SERVERDB,SERVERNODE,SNAPSHOT_LOG,UNLOADED,COMMENT
FROM SYSDD.TABLES
WHERE type IN('TABLE','RESULT','SYNONYM','SNAPSHOT','VIEW','SYSTEM')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TABLES TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.TABLE_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'TABLE',OWNER,TABLENAME,' ',' ',' ',' ',COMMENT
FROM DOMAIN.TABLES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.TERMCHARSETS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TERMCHARSETS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TERMCHARSETS
AS SELECT *
FROM SYSDD.TERMCHARSETS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TERMCHARSETS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TRIGGERS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TRIGGERS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TRIGGERS
(OWNER,TABLENAME,TRIGGERNAME,"INSERT","UPDATE","DELETE",
CREATEDATE,CREATETIME,DEFINITION,COMMENT)
AS SELECT
OWNER,TABLENAME,TRIGGERNAME,INSERT,UPDATE,DELETE,
"DATE","TIME",DEFINITION,COMMENT
FROM SYSDD.TRIGGERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TRIGGERS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.TRIGGER_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'TRIGGER',OWNER,TABLENAME,TRIGGERNAME,' ',' ',' ',COMMENT
FROM DOMAIN.TRIGGERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.TRIGGERPARAMS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TRIGGERPARAMS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TRIGGERPARAMS
(OWNER,TABLENAME,TRIGGERNAME,PARAMETERNAME,POS,"NEW/OLD-TYPE",
DATATYPE,LEN,"DEC",CREATEDATE,CREATETIME)
AS SELECT
OWNER,TABLENAME,TRIGGERNAME,PARAMETERNAME,PARAM_NO,"NEW/OLD_TYPE",
DECODE(DATATYPE,'BYTE','CHAR BYTE',DATATYPE),LEN,DEC,"DATE","TIME"
FROM SYSDD.TRIGGERPARAMETERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TRIGGERPARAMS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USERS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USERS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USERS
(OWNER,GROUPNAME,USERNAME,USERMODE,CONNECTMODE,PERMLIMIT,TEMPLIMIT,
MAXTIMEOUT,COSTWARNING,COSTLIMIT,CACHELIMIT,CREATEDATE,CREATETIME,ALTERDATE,
ALTERTIME,PWCREADATE,PWCREATIME,SERVERDB,SERVERNODE,USER_ID,COMMENT)
AS SELECT
OWNER,GROUPNAME,USERNAME,USERMODE,CONNECT,PERMLIMIT,TEMPLIMIT,
MAXTIMEOUT,COSTWARNING,COSTLIMIT,CACHELIMIT,"DATE","TIME",ALTERDATE,
ALTERTIME,PWCREATEDATE,PWCREATETIME,SERVERDB,SERVERNODE,USER_ID,COMMENT
FROM SYSDD.USERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT (OWNER,GROUPNAME,USERNAME,USERMODE,CONNECTMODE,PERMLIMIT,
TEMPLIMIT,MAXTIMEOUT,COSTWARNING,COSTLIMIT,CACHELIMIT,
CREATEDATE,CREATETIME,ALTERDATE,ALTERTIME,PWCREADATE,
PWCREATIME,SERVERDB,SERVERNODE,COMMENT)
ON DOMAIN.USERS TO PUBLIC WITH GRANT OPTION
/
CREATE VIEW DOMAIN.USER_
(OBJTYPE,OWNER,NAME1,NAME2,NAME3,SUBTYPE,VERSION,COMMENT)
AS SELECT
'USER',OWNER,GROUPNAME,USERNAME,' ',' ',' ',COMMENT
FROM DOMAIN.USERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.CONNECTEDUSERS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.CONNECTEDUSERS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.CONNECTEDUSERS
AS SELECT *
FROM SYSDD.CONNECTED_USERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.CONNECTEDUSERS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VERSIONS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VERSIONS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VERSIONS
AS SELECT *
FROM SYSDD.VERSION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VERSIONS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIEWS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIEWS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIEWS
(OWNER,VIEWNAME,PRIVILEGES,TYPE,CREATEDATE,CREATETIME,
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
REPLICATION,SERVERDB,SERVERNODE,UNLOADED,COMMENT)
AS SELECT
OWNER,TABLENAME,PRIVILEGES,TYPE,"DATE","TIME",
UPDSTATDATE,UPDSTATTIME,ALTERDATE,ALTERTIME,
DECODE(REPLICATION,'NONE','NO','UNKNOWN',NULL,'YES'),
SERVERDB,SERVERNODE,UNLOADED,COMMENT
FROM SYSDD.TABLES
WHERE type = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIEWS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIEWDEFS) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIEWDEFS
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIEWDEFS
(OWNER,VIEWNAME,LEN,DEFINITION)
AS SELECT
OWNER,TABLENAME,LEN,DEFINITION
FROM SYSDD.VIEWS
WHERE owner = USERGROUP
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIEWDEFS TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.FKC_REFS_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.FKC_REFS_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.FKC_REFS_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFCOLUMNNAME,DEFFKEYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
RULE,CREATEDATE,CREATETIME,FKEYCOMMENT)
AS SELECT
'COLUMN',OWNER,TABLENAME,COLUMNNAME,REFNAME,'REFERS',
'COLUMN',REFOWNER,REFTABLENAME,REFCOLUMNNAME,
RULE,"DATE","TIME",COMMENT
FROM SYSDD.FOREIGN_KEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.FKC_REFS_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.COL_REFS_DOM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.COL_REFS_DOM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.COL_REFS_DOM
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFCOLUMNNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFDOMAINNAME,CREATEDATE,CREATETIME)
AS SELECT
'COLUMN',OWNER,TABLENAME,COLUMNNAME,'REFERS',
'DOMAIN',DOMAINOWNER,DOMAINNAME,"DATE","TIME"
FROM SYSDD.COLUMNS
WHERE type IN('TABLE','RESULT','SYNONYM','SNAPSHOT','VIEW')
AND domainname IS NOT NULL
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.COL_REFS_DOM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.COL_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.COL_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.COL_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFCOLUMNNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
'COLUMN',OWNER,TABLENAME,COLUMNNAME,'USES',
'COLUMN',REFOWNER,REFTABLENAME,REFCOLUMNNAME,DATE,TIME
FROM SYSDD.REFERENCED_COLUMNS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.COL_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBP_CONT_PRM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBP_CONT_PRM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBP_CONT_PRM
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFDBPROCNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFDBPROCNAME,REFPARAMETERNAME,POS,
CREATEDATE,CREATETIME)
AS SELECT
'DBPROCEDURE',OWNER,PROGRAM,MODULE,'CONTAINS',
'DBPROCPARAM',OWNER,PROGRAM,MODULE,PARAMETERNAME,PARAM_NO,
"DATE","TIME"
FROM SYSDD.DBPROCPARAMETERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBP_CONT_PRM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBP_REFS_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBP_REFS_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBP_REFS_MOD
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFDBPROCNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME)
AS SELECT
'DBPROCEDURE',OWNER,PROGRAM,MODULE,'REFERS',
'MODULE',OWNER,PROGRAM,MODULE,'SQL-PL',
"DATE","TIME"
FROM SYSDD.DBPROCEDURES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBP_REFS_MOD TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBF_CONT_PRM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBF_CONT_PRM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBF_CONT_PRM
(DEFOBJTYPE,DEFOWNER,DEFDBFUNCNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFDBFUNCNAME,REFPARAMETERNAME,POS,
CREATEDATE,CREATETIME)
AS SELECT
'DBFUNCTION',OWNER,DBFUNCTION,'CONTAINS',
'DBFUNCPARAM',OWNER,DBFUNCTION,PARAMETERNAME,PARAM_NO,
"DATE","TIME"
FROM SYSDD.DBFUNCTIONPARAMS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBF_CONT_PRM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.DBF_REFS_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.DBF_REFS_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.DBF_REFS_MOD
(DEFOBJTYPE,DEFOWNER,DEFDBFUNCNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME)
AS SELECT
'DBFUNCTION',OWNER,DBFUNCTION,'REFERS',
'MODULE',OWNER,PROGRAM,DBPROCEDURE,'SQL-PL',
"DATE","TIME"
FROM SYSDD.DBFUNCTIONS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.DBF_REFS_MOD TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#ECM_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#ECM_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'EASYCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#ECM_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#ECM_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.ECM_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.ECM_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.ECM_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,DEFTABLEOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#ECM_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.ECM_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#ECM_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#ECM_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'EASYCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#ECM_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#ECM_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#ECM_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#ECM_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.ECM_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.ECM_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.ECM_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,DEFTABLEOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#ECM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.ECM_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.ECM_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.ECM_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.ECM_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,DEFTABLEOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#ECM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.ECM_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.ECM_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.ECM_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.ECM_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,DEFTABLEOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#ECM_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.ECM_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.ECM_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.ECM_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.ECM_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,DEFTABLEOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#ECM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.ECM_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#EFM_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#EFM_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'EASYFORM',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#EFM_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#EFM_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.EFM_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EFM_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EFM_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFORMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#EFM_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EFM_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#EFM_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#EFM_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'EASYFORM',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#EFM_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#EFM_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#EFM_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#EFM_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.EFM_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EFM_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EFM_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFORMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#EFM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EFM_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.EFM_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EFM_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EFM_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFORMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#EFM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EFM_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.EFM_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EFM_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EFM_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFORMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#EFM_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EFM_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.EFM_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.EFM_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.EFM_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFORMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#EFM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.EFM_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.FOK_REFS_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.FOK_REFS_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.FOK_REFS_TAB
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFKEYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
'FOREIGNKEY',OWNER,TABLENAME,REFNAME,'REFERS',
'TABLE',REFOWNER,REFTABLENAME,"DATE","TIME"
FROM SYSDD.FOREIGN_KEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.FOK_REFS_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.FOK_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.FOK_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.FOK_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFFKEYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
'FOREIGNKEY',OWNER,TABLENAME,REFNAME,'USES',
'COLUMN',REFOWNER,REFTABLENAME,REFCOLUMNNAME,"DATE","TIME"
FROM SYSDD.FOREIGN_KEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.FOK_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.IND_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.IND_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.IND_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFINDEXNAME,
RELTYPE,REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
TYPE,POS,SORT,CREATEDATE,CREATETIME,INDEXCOMMENT)
AS SELECT
'INDEX',OWNER,TABLENAME,DECODE(INDEXNAME,' ',COLUMNNAME,INDEXNAME),
'USES','COLUMN',OWNER,TABLENAME,COLUMNNAME,
TYPE,COLUMNNO,SORT,"DATE","TIME",COMMENT
FROM SYSDD.INDEXES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.IND_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_CALL_DBP) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_CALL_DBP
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'CALLS',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'DBPROCEDURE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CALLMODE CHAR(20) ASCII,
CALLCOND CHAR(254) ASCII,
PARAMS CHAR(254) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_CALL_DBP
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_CALL_DBP
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MOD_CALL_DBP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_CALL_DBP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_CALL_DBP
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFDBPROCNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_CALL_DBP
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_CALL_DBP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_CALL_MOD) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_CALL_MOD
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'CALLS',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CALLMODE CHAR(20) ASCII,
CALLCOND CHAR(254) ASCII,
PARAMS CHAR(254) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_CALL_MOD
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_CALL_MOD
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MOD_CALL_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_CALL_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_CALL_MOD
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3,
CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_CALL_MOD
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_CALL_MOD TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_USES_DOM) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_USES_DOM
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'DOMAIN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_USES_DOM
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_USES_DOM
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_DOM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_DOM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_DOM
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFDOMAINNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_DOM
WHERE defowner = USERGROUP OR refowner LIKE '*'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_DOM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_USES_QCM) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_USES_QCM
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QUERYCOMMAND',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_USES_QCM
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_USES_QCM
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_QCM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_QCM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_QCM
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFCOMMANDNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_QCM
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_QCM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#MOD_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#MOD_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'MODULE',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
DDLUSAGE CHAR(1) ASCII,
DMLUSAGE CHAR(20) ASCII,
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#MOD_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#MOD_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#MOD_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#MOD_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.MOD_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.MOD_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.MOD_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFMODULENAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#MOD_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.MOD_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#PRO_CONT_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.#PRO_CONT_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.#PRO_CONT_MOD
(DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME)
AS SELECT
'PROGRAM',OWNER,MODULENAME1,PROGLANG,'CONTAINS',
'MODULE',OWNER,MODULENAME1,MODULENAME2,PROGLANG,
CREATEDATE,CREATETIME
FROM DOMAIN.MODULE
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.PRO_CONT_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.PRO_CONT_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.PRO_CONT_MOD
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFPROGRAMNAME,DEFPROGLANG,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME
FROM DOMAIN.#PRO_CONT_MOD
WHERE defowner = USERGROUP
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.PRO_CONT_MOD TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QCM_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QCM_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QUERYCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QCM_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QCM_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QCM_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QCM_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QCM_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#QCM_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QCM_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QCM_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QCM_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QUERYCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QCM_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QCM_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#QCM_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#QCM_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.QCM_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QCM_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QCM_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QCM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QCM_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QCM_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QCM_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QCM_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QCM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QCM_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QCM_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QCM_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QCM_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QCM_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QCM_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QCM_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QCM_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QCM_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QCM_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QCM_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPC_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPC_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPC_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPC_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#QPC_USES_COL COLUMN REFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.QPC_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPC_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPC_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#QPC_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPC_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPC_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPC_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPCOMMAND',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPC_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPC_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#QPC_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#QPC_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#QPC_USES_TAB COLUMN REFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.QPC_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPC_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPC_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPC_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPC_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPC_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPC_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPC_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPC_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPC_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPC_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPC_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPC_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPC_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPC_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPC_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPC_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPC_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFCOMMANDNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPC_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPC_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPQ_USES_COL) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPQ_USES_COL
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPQUERY',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'COLUMN',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPQ_USES_COL
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPQ_USES_COL
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#QPQ_USES_COL COLUMN REFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.QPQ_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQ_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQ_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFQUERYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),REFOBJNAME2,CREATEDATE,CREATETIME
FROM DOMAIN.#QPQ_USES_COL
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQ_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPQ_USES_TAB) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPQ_USES_TAB
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPQUERY',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'TABLE',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
TYPE CHAR(8) ASCII,
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPQ_USES_TAB
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPQ_USES_TAB
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
/
IF $RC (SHOW COLUMN DOMAIN.#QPQ_USES_TAB.TYPE) <> 0
THEN
BEGIN
/
ALTER TABLE DOMAIN.#QPQ_USES_TAB ADD (TYPE CHAR(8) ASCII)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
ELSE
BEGIN
/
ALTER TABLE DOMAIN.#QPQ_USES_TAB COLUMN REFOBJNAME1 CHAR(150) ASCII
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
END
/
COMMIT WORK
/
IF $RC (EXISTS TABLE DOMAIN.QPQ_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQ_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQ_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFQUERYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPQ_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SNAPSHOT'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQ_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPQ_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQ_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQ_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFQUERYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPQ_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'SYNONYM'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQ_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPQ_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQ_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQ_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFQUERYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPQ_USES_TAB
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQ_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.QPQ_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPQ_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPQ_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFQUERYNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
TYPE,REFOWNER,SUBSTR(REFOBJNAME1,1,18),CREATEDATE,CREATETIME
FROM DOMAIN.#QPQ_USES_TAB
WHERE USERGROUP IN(defowner,refowner) AND type = 'VIEW'
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPQ_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPE_USES_QPC) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPE_USES_QPC
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPEXCELLINK',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPCOMMAND',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPE_USES_QPC
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPE_USES_QPC
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPE_USES_QPC) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPE_USES_QPC
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPE_USES_QPC
(DEFOBJTYPE,DEFOWNER,DEFEXCELLINKNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFCOMMANDNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QPE_USES_QPC
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPE_USES_QPC TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPE_USES_QPQ) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPE_USES_QPQ
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPEXCELLINK',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPQUERY',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPE_USES_QPQ
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPE_USES_QPQ
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPE_USES_QPQ) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPE_USES_QPQ
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPE_USES_QPQ
(DEFOBJTYPE,DEFOWNER,DEFEXCELLINKNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFQUERYNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QPE_USES_QPQ
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPE_USES_QPQ TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPW_USES_QPC) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPW_USES_QPC
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPWORDLINK',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPCOMMAND',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPW_USES_QPC
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPW_USES_QPC
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPW_USES_QPC) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPW_USES_QPC
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPW_USES_QPC
(DEFOBJTYPE,DEFOWNER,DEFWORDLINKNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFCOMMANDNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QPW_USES_QPC
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPW_USES_QPC TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.#QPW_USES_QPQ) <> 0
THEN
BEGIN
/
CREATE TABLE DOMAIN.#QPW_USES_QPQ
(
USER_ID FIXED(10) KEY,
ROW_ID CHAR(8) BYTE KEY,
DEFOWNER CHAR(18) ASCII,
DEFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
DEFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
DEFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
DEFOBJTYPE CHAR(18) ASCII DEFAULT 'QPWORDLINK',
DEFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
DEFVERSION CHAR(4) ASCII DEFAULT ' ',
RELTYPE CHAR(18) ASCII DEFAULT 'USES',
REFOWNER CHAR(18) ASCII,
REFOBJNAME1 CHAR(150) ASCII DEFAULT ' ',
REFOBJNAME2 CHAR(18) ASCII DEFAULT ' ',
REFOBJNAME3 CHAR(18) ASCII DEFAULT ' ',
REFOBJTYPE CHAR(18) ASCII DEFAULT 'QPQUERY',
REFSUBTYPE CHAR(12) ASCII DEFAULT ' ',
REFVERSION CHAR(4) ASCII DEFAULT ' ',
CREATEDATE DATE DEFAULT DATE,
CREATETIME TIME DEFAULT TIME
)
WITH REPLICATION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX1 ON DOMAIN.#QPW_USES_QPQ
(DEFOWNER,DEFOBJNAME1,DEFOBJNAME2,DEFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
CREATE INDEX INDEX2 ON DOMAIN.#QPW_USES_QPQ
(REFOWNER,REFOBJNAME1,REFOBJNAME2,REFOBJNAME3)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
END
/
IF $RC (EXISTS TABLE DOMAIN.QPW_USES_QPQ) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.QPW_USES_QPQ
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.QPW_USES_QPQ
(DEFOBJTYPE,DEFOWNER,DEFWORDLINKNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFQUERYNAME,CREATEDATE,CREATETIME)
AS SELECT
DEFOBJTYPE,DEFOWNER,DEFOBJNAME1,RELTYPE,
REFOBJTYPE,REFOWNER,REFOBJNAME1,CREATEDATE,CREATETIME
FROM DOMAIN.#QPW_USES_QPQ
WHERE USERGROUP IN(defowner,refowner)
WITH CHECK OPTION
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.QPW_USES_QPQ TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNP_CONT_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNP_CONT_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNP_CONT_COL
(DEFOBJTYPE,DEFOWNER,DEFSNAPSHOTNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
POS,CREATEDATE,CREATETIME)
AS SELECT
TYPE,OWNER,TABLENAME,'CONTAINS',
'COLUMN',OWNER,TABLENAME,COLUMNNAME,
COLUMNNO,"DATE","TIME"
FROM SYSDD.COLUMNS
WHERE type = 'SNAPSHOT'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNP_CONT_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNP_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNP_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNP_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFSNAPSHOTNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'SNAPSHOT' AND refkind = 'SYNONYM'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNP_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNP_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNP_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNP_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFSNAPSHOTNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'SNAPSHOT'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNP_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SNP_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SNP_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SNP_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFSNAPSHOTNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'SNAPSHOT' AND refkind = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SNP_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SYN_REFS_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SYN_REFS_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SYN_REFS_SNP
(DEFOBJTYPE,DEFOWNER,DEFSYNONYMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT
'SYNONYM',USERGROUP,S.SYNONYMNAME,'REFERS',
T.TYPE,S.OWNER,S.TABLENAME,S."DATE",S."TIME"
FROM SYSDD.SYNONYMS S, SYSDD.TABLES T
WHERE T.owner = S.owner
AND T.tablename = S.tablename
AND T.type = 'SNAPSHOT'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SYN_REFS_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SYN_REFS_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SYN_REFS_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SYN_REFS_TAB
(DEFOBJTYPE,DEFOWNER,DEFSYNONYMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT
'SYNONYM',USERGROUP,S.SYNONYMNAME,'REFERS',
T.TYPE,S.OWNER,S.TABLENAME,S."DATE",S."TIME"
FROM SYSDD.SYNONYMS S, SYSDD.TABLES T
WHERE T.owner = S.owner
AND T.tablename = S.tablename
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SYN_REFS_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.SYN_REFS_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.SYN_REFS_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.SYN_REFS_VIE
(DEFOBJTYPE,DEFOWNER,DEFSYNONYMNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT
'SYNONYM',USERGROUP,S.SYNONYMNAME,'REFERS',
T.TYPE,S.OWNER,S.TABLENAME,S."DATE",S."TIME"
FROM SYSDD.SYNONYMS S, SYSDD.TABLES T
WHERE T.owner = S.owner
AND T.tablename = S.tablename
AND T.type = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.SYN_REFS_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TAB_CONT_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TAB_CONT_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TAB_CONT_COL
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
POS,CREATEDATE,CREATETIME)
AS SELECT
TYPE,OWNER,TABLENAME,'CONTAINS',
'COLUMN',OWNER,TABLENAME,COLUMNNAME,
COLUMNNO,"DATE","TIME"
FROM SYSDD.COLUMNS
WHERE type IN('TABLE','RESULT','SYNONYM','SNAPSHOT','VIEW')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TAB_CONT_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TAB_CONT_FOK) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TAB_CONT_FOK
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TAB_CONT_FOK
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFFKEYNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
'TABLE',OWNER,TABLENAME,'CONTAINS',
'FOREIGNKEY',OWNER,TABLENAME,REFNAME,"DATE","TIME"
FROM SYSDD.FOREIGN_KEYS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TAB_CONT_FOK TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TAB_CONT_IND) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TAB_CONT_IND
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TAB_CONT_IND
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFINDEXNAME,
CREATEDATE,CREATETIME)
AS SELECT
'TABLE',OWNER,TABLENAME,'CONTAINS',
'INDEX',OWNER,TABLENAME,INDEXNAME,
CREATEDATE,CREATETIME
FROM DOMAIN.INDEXES
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TAB_CONT_IND TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TAB_CONT_TRG) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TAB_CONT_TRG
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TAB_CONT_TRG
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFTRIGGERNAME,CREATEDATE,CREATETIME)
AS SELECT
'TABLE',OWNER,TABLENAME,'CONTAINS',
'TRIGGER',OWNER,TABLENAME,TRIGGERNAME,"DATE","TIME"
FROM SYSDD.TRIGGERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TAB_CONT_TRG TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TAB_USES_CON) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TAB_USES_CON
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TAB_USES_CON
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCONSTRAINTNAME)
AS SELECT
'TABLE',OWNER,TABLENAME,'USES',
'CONSTRAINT',OWNER,TABLENAME,CONSTRAINTNAME
FROM SYSDD.CONSTRAINTS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TAB_USES_CON TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TRG_CONT_PRM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TRG_CONT_PRM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TRG_CONT_PRM
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFTRIGGERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFTRIGGERNAME,REFPARAMETERNAME,POS,
CREATEDATE,CREATETIME)
AS SELECT
'TRIGGER',OWNER,TABLENAME,TRIGGERNAME,'CONTAINS',
'TRIGGERPARAM',OWNER,TABLENAME,TRIGGERNAME,PARAMETERNAME,PARAM_NO,
"DATE","TIME"
FROM SYSDD.TRIGGERPARAMETERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TRG_CONT_PRM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.TRG_REFS_MOD) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.TRG_REFS_MOD
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.TRG_REFS_MOD
(DEFOBJTYPE,DEFOWNER,DEFTABLENAME,DEFTRIGGERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFMODULENAME,REFPROGLANG,
CREATEDATE,CREATETIME)
AS SELECT
'TRIGGER',OWNER,TABLENAME,TRIGGERNAME,'REFERS',
'MODULE',OWNER,PROGRAM,DBTRIGGER,'SQL-PL',
"DATE","TIME"
FROM SYSDD.TRIGGERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.TRG_REFS_MOD TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_OWNS_DBF) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_OWNS_DBF
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_OWNS_DBF
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFDBFUNCNAME,CREATEDATE,CREATETIME)
AS SELECT
'USER',U.OWNER_OWNER,D.OWNER,D.OWNER,'OWNS',
'DBFUNCTION',D.OWNER,D.DBFUNCTION,D."DATE",D."TIME"
FROM SYSDD.DBFUNCTIONS D,SYSDD.USERS U
WHERE D.owner in(U.username,U.groupname)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_OWNS_DBF TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_OWNS_DOM) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_OWNS_DOM
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_OWNS_DOM
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFDOMAINNAME,CREATEDATE,CREATETIME)
AS SELECT
'USER',U.OWNER_OWNER,D.OWNER,D.OWNER,'OWNS',
'DOMAIN',D.OWNER,D.DOMAINNAME,D."DATE",D."TIME"
FROM SYSDD.DOMAINS D,SYSDD.USERS U
WHERE D.owner IN(U.username,U.groupname)
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_OWNS_DOM TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_OWNS_USR) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_OWNS_USR
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_OWNS_USR
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFGROUPNAME,REFUSERNAME,CREATEDATE,CREATETIME)
AS SELECT
'USER',OWNER_OWNER,OWNER,OWNER,'OWNS',
'USER',OWNER,GROUPNAME,USERNAME,"DATE","TIME"
FROM SYSDD.USERS
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_OWNS_USR TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_COL
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
PRIVILEGES,CREATEDATE,CREATETIME,GRANTOR)
AS SELECT
'USER',GRANTEEOWNER,GRANTEE,GRANTEE,'USES',
'COLUMN',OWNER,NAME1,DECODE(NAME2,NULL,'- ALL COLUMNS -',NAME2),
PRIVILEGES,"DATE","TIME",GRANTOR
FROM SYSDD.PRIVILEGES
WHERE type NOT IN('DBPROC','SEQUENCE')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_DBP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_DBP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_DBP
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFPROGRAMNAME,REFDBPROCNAME,CREATEDATE,CREATETIME)
AS SELECT
'USER',GRANTEEOWNER,GRANTEE,GRANTEE,'USES',
'DBPROCEDURE',OWNER,NAME1,NAME2,"DATE","TIME"
FROM SYSDD.PRIVILEGES
WHERE type = 'DBPROC' AND grantee <> owner
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_DBP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
'USER',GRANTEEOWNER,GRANTEE,GRANTEE,'USES',
TYPE,OWNER,NAME1,PRIVILEGES,"DATE","TIME"
FROM SYSDD.PRIVILEGES
WHERE name2 IS NULL AND type = 'SNAPSHOT'
AND type NOT IN('DBPROC','SEQUENCE')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
'USER',GRANTEEOWNER,GRANTEE,GRANTEE,'USES',
TYPE,OWNER,NAME1,PRIVILEGES,"DATE","TIME"
FROM SYSDD.PRIVILEGES
WHERE name2 IS NULL AND type NOT IN('DBPROC','SEQUENCE')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.USR_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.USR_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.USR_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFGROUPNAME,DEFUSERNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,PRIVILEGES,CREATEDATE,CREATETIME)
AS SELECT
'USER',GRANTEEOWNER,GRANTEE,GRANTEE,'USES',
TYPE,OWNER,NAME1,PRIVILEGES,"DATE","TIME"
FROM SYSDD.PRIVILEGES
WHERE name2 IS NULL AND type = 'VIEW'
AND type NOT IN('DBPROC','SEQUENCE')
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.USR_USES_VIE TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIE_CONT_COL) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIE_CONT_COL
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIE_CONT_COL
(DEFOBJTYPE,DEFOWNER,DEFVIEWNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,REFCOLUMNNAME,
POS,CREATEDATE,CREATETIME)
AS SELECT
TYPE,OWNER,TABLENAME,'CONTAINS',
'COLUMN',OWNER,TABLENAME,COLUMNNAME,
COLUMNNO,"DATE","TIME"
FROM SYSDD.COLUMNS
WHERE type = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIE_CONT_COL TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIE_USES_SNP) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIE_USES_SNP
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIE_USES_SNP
(DEFOBJTYPE,DEFOWNER,DEFVIEWNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSNAPSHOTNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'VIEW' AND refkind = 'SNAPSHOT'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIE_USES_SNP TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIE_USES_SYN) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIE_USES_SYN
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIE_USES_SYN
(DEFOBJTYPE,DEFOWNER,DEFVIEWNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFSYNONYMNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'VIEW' AND refkind = 'SYNONYM'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIE_USES_SYN TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIE_USES_TAB) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIE_USES_TAB
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIE_USES_TAB
(DEFOBJTYPE,DEFOWNER,DEFVIEWNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFTABLENAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIE_USES_TAB TO PUBLIC WITH GRANT OPTION
/
IF $RC (EXISTS TABLE DOMAIN.VIE_USES_VIE) = 0
THEN
BEGIN
/
DROP VIEW DOMAIN.VIE_USES_VIE
/
COMMIT WORK
/
END
/
CREATE VIEW DOMAIN.VIE_USES_VIE
(DEFOBJTYPE,DEFOWNER,DEFVIEWNAME,RELTYPE,
REFOBJTYPE,REFOWNER,REFVIEWNAME,CREATEDATE,CREATETIME)
AS SELECT DISTINCT
TYPE,OWNER,TABLENAME,'USES',
REFKIND,REFNAME,REFTABLENAME,DATE,TIME
FROM SYSDD.VIEW_USES_TABLE
WHERE type = 'VIEW' AND refkind = 'VIEW'
/
IF $RC <> 0
THEN
BEGIN
/
END INIT SERVERDB
/
STOP 7
/
END
/
COMMIT WORK
/
GRANT SELECT ON DOMAIN.VIE_USES_VIE TO PUBLIC WITH GRANT OPTION
/
END INIT SERVERDB
/
INCLUDE '%DBROOT%\env\XDDCOM.ins'
/
INCLUDE '%DBROOT%\env\SHOWQCM.ins'
/
INCLUDE '%DBROOT%\env\SHOWCMD.ins'
/
INCLUDE '%DBROOT%\env\SYSPROC.ins'
/