Rem 
Rem $Id: frm4bild.sql,v 1.1 1999/01/06 21:31:08 oraforms Exp $ 
Rem 
Rem  Copyright (c) 1991 by Oracle Corporation 
Rem    NAME
Rem      frmcreate.sql - <one-line expansion of the name>
Rem    DESCRIPTION
Rem      Build the Forms tables and views
Rem    RETURNS
Rem 
Rem    NOTES
Rem      This does not drop the table/view definitions first
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem     kyue       09/14/93 -  adding a column for lib external location 
Rem     kyue       08/26/93 -  upgrade the version number 
Rem     smuench    08/22/93 -  Fix Problem with MnuGrp / Rem out Views
Rem     kyue       08/18/93 -  create the synonym for the base tables 
Rem     pkuhn      08/16/93 -  Add IFRM40_MNUITM2 index 
Rem     pkuhn      08/12/93 -  Grant select to FRM40__NAMELIST to public 
Rem     rgiljum    07/31/93 - #(155216) Bump up menu name width 
Rem     pkuhn      07/29/93 -  Add public synonym for frm40__namelist 
Rem     kyue       06/26/93 -  adding a column to item 
Rem     fdancs     06/23/93 -  add appnlslang column 
Rem     smuench    05/04/93 -  Change CHAR to VARCHAR for V7
Rem     pkuhn      04/12/93 -  Put back column in frm40__mnuitm; 
Rem     kyue       04/01/93 -  adding a new column in frm40_rbt; 
Rem     kyue       02/16/93 -  saving a join condition as an index 
Rem     kyue       02/11/93 -  adding the menu item in menu item table 
Rem     rgiljum    01/29/93 -  Fix sql script 
Rem     rgiljum    01/18/93 -  AOL changes 
Rem     kyue       01/18/93 -  fix merge error 
Rem     kyue       12/14/92 -  change table definition to store ui string ID 
Rem     rgiljum    12/15/92 -  Add list support 
Rem     rgiljum    12/07/92 -  Creation 
Rem     kyue       11/17/92 -  update the version number 
Rem     rgiljum    11/16/92 -  Add default value for form parameters 
Rem     kyue       11/13/92 -  modify trigger and radio button table 
Rem     rgiljum    11/02/92 - #(133758) Adjust lengths 
Rem     enewman    11/12/92 -  Make changes to indexes to improve performance. 
Rem     pkuhn      09/24/92 -  No longer need FRM40_CIRSEQ or FRM40_MNUCIR
Rem     kyue       09/23/92 -  change the index definiton of lovcol and rgpcol 
Rem     bhill      09/08/92 -  add semicolon 
Rem     rgiljum    08/19/92 - #(124199) Bump menu item name field 
Rem     pkuhn      09/03/92 -  Add synonym for FRM40__MNUAPP 
Rem     bhill      08/31/92 -  add scrollbar support 
Rem     pkuhn      07/21/92 -  Add index for frm40_Mnuuser 
Rem     kyue       08/03/92 -  fix problem of creating view 
Rem     kyue       07/27/92 -  fix libextloc table schema 
Rem     kyue       07/22/92 -  adding table for library external location 
Rem     kyue       07/19/92 -  modify the frm40_ref schema 
Rem     pkuhn      06/18/92 -  Add circular menu detection 
Rem     kyue       06/04/92 -  update the table schema 
Rem     pkuhn      06/01/92 -  Need to grant select on FRM40__MNUAPP to public 
Rem     kmallory   05/28/92 -  Creation 
Rem     kmallory   05/28/92 -  Creation 

Rem
Rem
Rem  SQL*Forms 4.0 create table script
Rem
Rem

Rem
Rem
Rem Create reference table
Rem 
Rem
Rem
create table FRM40__REF
(
   OWNER        VARCHAR(30),
   MODID        NUMBER(9),
   APPNAME      VARCHAR(30),
   OBJTYPE      NUMBER,
   OBJNAME      VARCHAR(30),
   SUBNAME1     VARCHAR(30),
   SUBNAME2     VARCHAR(30),
   SEQUENCE     NUMBER,
   REFOWNER     VARCHAR(30),
   REFMODID     NUMBER,
   REFAPPTYPE   NUMBER,
   REFAPPNAME   VARCHAR(30),
   REFOBJTYPE   NUMBER,
   REFOBJNAME   VARCHAR(30),
   REFSUBNAME1  VARCHAR(30),
   REFSUBNAME2  VARCHAR(30),
   SUBNAME3     VARCHAR(30),
   CVNAME       VARCHAR(30),
   COMMENTID    DECIMAL(9),
   X            NUMBER,
   Y            NUMBER,
   HT           NUMBER,
   WD           NUMBER,
   APPTYPE      NUMBER,
   ITEMID       DECIMAL(9),
   REFITEMID    DECIMAL(9)
);

create index ifrm40_ref on frm40__ref(modid);

REM
REM create view FRM40_REF as 
REM        select OWNER, MODID, APPNAME, OBJTYPE, OBJNAME, SUBNAME1,
REM               SUBNAME2, SEQUENCE, REFOWNER, REFMODID, REFAPPTYPE,
REM               REFAPPNAME, REFOBJTYPE, REFOBJNAME, REFSUBNAME1,
REM               REFSUBNAME2, SUBNAME3, CVNAME, COMMENTID, X, Y, HT, 
REM               WD, APPTYPE, ITEMID, REFITEMID
REM        from FRM40__REF 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible) ;
REM

create public synonym FRM40_REF for system.FRM40__REF;

Rem
Rem 
Rem Create Text table
Rem
Rem
create table FRM40__TEXT
(
   OWNER       VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   TXTORDER     NUMBER,      
   TXTTEXT     VARCHAR(80)     
);

create index ifrm40_text on frm40__text(modid,itemid);

REM
REM create view FRM40_TEXT as 
REM        select OWNER, MODID, ITEMID, TXTORDER, TXTTEXT
REM        from FRM40__TEXT 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_TEXT for system.FRM40__TEXT;

Rem
Rem This table is obselete.
Rem 
Rem Create Doc table
Rem
Rem
Rem create table FRM40__DOC
Rem (
Rem   OWNER        VARCHAR(30),
Rem   MODID        DECIMAL(9),
Rem   ITEMID       DECIMAL(9),
Rem   DCAPPID      DECIMAL(9),
Rem   DCDTYPE      VARCHAR(1),
Rem   CREATOR      VARCHAR(30),
Rem   CREATE_DATE  DATE,
Rem   CREATE_VER   DECIMAL(6),
Rem   MODIFIER     VARCHAR(30),
Rem   MOD_DATE     DATE,
Rem   MOD_VER      DECIMAL(6),
Rem   COPYRIGHT    VARCHAR(250)
Rem );

Rem create unique index ifrm40_doc on frm40__doc(modid,itemid);

REM
REM OBSOLETE
REM create view FRM40_DOC as 
REM       select OWNER, MODID, ITEMID, DCAPPID, DCDTYPE, CREATOR,
REM              CREATE_DATE, CREATE_VER, MODIFIER, MOD_DATE, 
REM              MOD_VER, COPYRIGHT
REM       from FRM40__DOC
REM       where upper(owner) = upper(user) or 
REM       modid in ( select modid from tool_accessible );
REM create public synonym FRM40_DOC for system.FRM40_DOC;
REM

create table FRM40__APP
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),   
   APPNAME      VARCHAR(30),
   APPTITLEI    DECIMAL(9),
   APPMNAME     VARCHAR(255),
   APPMNUAPL    VARCHAR(30),
   APPMNUGRP    VARCHAR(30),
   APPOBJNUM    NUMBER,
   APPVAUNIT    NUMBER,
   APPMOUSE     NUMBER,
   APPMNUSTY    NUMBER,
   APPUCHARC    NUMBER,
   APPRCORUNIT  NUMBER,
   APPCCWID     NUMBER,
   APPCCHT      NUMBER,
   APPDCHARC    NUMBER,
   APPDHRES     NUMBER,
   APPDVRES     NUMBER,
   APPRCORRES   NUMBER,
   APPFLAG      NUMBER,
   APPFNAME     VARCHAR(255),
   APPCMODE     NUMBER,
   APPFNAVBLK   VARCHAR(30),
   APPNLSLANG   VARCHAR(40)
);

create unique index ifrm40_app on frm40__app(modid,itemid);

REM
REM create view FRM40_APP as 
REM        select OWNER, MODID, ITEMID, APPNAME, APPTITLEI, APPMNAME,
REM               APPMNUAPL, APPMNUGRP, APPOBJNUM, APPVAUNIT,
REM               APPMOUSE, APPMNUSTY, APPUCHARC, APPRCORUNIT,
REM               APPCCWID, APPCCHT, APPDCHARC, APPDHRES, APPDVRES,
REM               APPRCORRES, APPFLAG, APPFNAME, APPCMODE, APPFNAVBLK, 
REM               APPNLSLANG
REM        from FRM40__APP 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM
REM
create public synonym FRM40_APP for system.FRM40__APP;

create table FRM40__BLK
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       NUMBER,
   BLKNAME      VARCHAR(30),
   BLKTOWNER    VARCHAR(61),
   BLKDESCI     DECIMAL(9),
   BLKWHR       DECIMAL(9),
   BLKOBY       DECIMAL(9),
   BLKBLIN      NUMBER,
   BLKARSIZ     NUMBER,
   BLKNOREC     NUMBER,
   BLKNOBUF     NUMBER,
   BLKSEQ       NUMBER,
   BLKLNRC      VARCHAR(1),
   BLKKMODE     NUMBER,
   BLKLMODE     NUMBER,
   BLKFLAG      NUMBER,
   BLKNNAVBLK   VARCHAR(30),
   BLKPNAVBLK   VARCHAR(30),
   BLKNSTYLE    NUMBER
);

create unique index ifrm40_blk on frm40__blk(modid,itemid);

REM
REM create view FRM40_BLK as 
REM        select OWNER, MODID, ITEMID, BLKNAME, BLKTOWNER, BLKDESCI,
REM               BLKWHR, BLKOBY, BLKBLIN, BLKARSIZ, BLKNOREC, BLKNOBUF,
REM               BLKSEQ, BLKLNRC, BLKKMODE, BLKLMODE, BLKFLAG,
REM               BLKNNAVBLK, BLKPNAVBLK, BLKNSTYLE
REM        from FRM40__BLK 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_BLK for system.FRM40__BLK;

create table FRM40__RELATION
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   PARENTID    DECIMAL(9),
   RLNAME      VARCHAR(30),
   RLDET       VARCHAR(30),
   RLFLAG      NUMBER,
   RLDEL       NUMBER,
   RLJOINI     DECIMAL(9)
);

create unique index ifrm40_relation on frm40__relation(modid,itemid);

REM
REM create view FRM40_RELATION as
REM        select OWNER, MODID, ITEMID, PARENTID, RLNAME, RLDET,
REM               RLFLAG, RLDEL, RLJOINI
REM        from FRM40__RELATION
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_RELATION for system.FRM40__RELATION;

create table FRM40__TRG
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   TRGNAME      VARCHAR(30),
   TRGDESC      DECIMAL(9),
   TRGPTYPE     NUMBER,
   TRGTYPE      NUMBER,
   TRGFLAG      NUMBER,
   GROUPL1      DECIMAL(9),
   GROUPL2      DECIMAL(9)
);

create unique index ifrm40_trg on frm40__trg(modid,itemid);

REM
REM create view FRM40_TRG as 
REM        select OWNER, MODID, ITEMID, PARENTID, TRGNAME, TRGDESC,
REM               TRGPTYPE, TRGTYPE, TRGFLAG, GROUPL1, GROUPL2
REM        from FRM40__TRG 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_TRG for system.FRM40__TRG;

create table FRM40__ITM
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   ITMTYPE      NUMBER,
   ITMDTYPE     NUMBER,
   ITMNAME      VARCHAR(30),
   ITMLEN       NUMBER,
   ITMLABELI    DECIMAL(9),
   ITMCANVAS    NUMBER,
   ITMX         NUMBER,
   ITMY         NUMBER,
   ITMH         NUMBER,
   ITMWD        NUMBER,
   ITMHINTI     DECIMAL(9),
   ITMDVALI     DECIMAL(9),
   ITMCOPY      VARCHAR(61),
   ITMVA        NUMBER,
   ITMSEQ       NUMBER,
   ITMQLEN      NUMBER,
   ITMBBEVEL    NUMBER,
   ITMALIGN     NUMBER,
   ITMCVAL      VARCHAR(80),
   ITMUCVAL     VARCHAR(80),
   ITMOVAL      NUMBER,
   ITMIMASK     VARCHAR(30),
   ITMOMASK     VARCHAR(30),
   ITMHIGHI     DECIMAL(9),
   ITMLOWI      DECIMAL(9),
   ITMLOVNAME   VARCHAR(30),
   ITMEDNAME    VARCHAR(30),
   ITMLOVX      NUMBER,
   ITMLOVY      NUMBER,
   ITMEDX       NUMBER,
   ITMEDY       NUMBER,
   ITMWRAPSTY   NUMBER,
   ITMCASESTY   NUMBER,
   ITMSIZSTY    NUMBER,
   ITMQUALITY   NUMBER,
   ITMFLAG      NUMBER,
   ITMOTHER     VARCHAR(80),
   ITMDBR       NUMBER,
   ITMLSTSTY    NUMBER
);

create unique index ifrm40_itm on frm40__itm(modid,itemid);

REM
REM create view FRM40_ITM as 
REM        select OWNER, MODID, ITEMID, PARENTID, ITMTYPE, ITMDTYPE,
REM               ITMNAME, ITMLEN, ITMLABELI, ITMCANVAS,
REM               ITMX, ITMY, ITMH, ITMWD, ITMHINTI, ITMDVALI, ITMCOPY, ITMVA,
REM               ITMSEQ, ITMQLEN, ITMBBEVEL, ITMALIGN, ITMCVAL, ITMUCVAL,
REM               ITMOVAL, ITMIMASK, ITMOMASK, ITMHIGHI, ITMLOWI, ITMLOVNAME,
REM               ITMEDNAME, ITMLOVX, ITMLOVY, ITMEDX, ITMEDY,
REM               ITMWRAPSTY, ITMCASESTY, ITMSIZSTY, ITMQUALITY, ITMFLAG, 
REM               ITMOTHER, ITMDBR, ITMLSTSTY
REM        from FRM40__ITM 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_ITM for system.FRM40__ITM;

create table FRM40__RBT
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   RBNAME       VARCHAR(30),
   RBLABELI     DECIMAL(9),
   RBVALUE      VARCHAR(80),
   RBVA         NUMBER,
   RBX          NUMBER,
   RBY          NUMBER,
   RBHT         NUMBER,
   RBWD         NUMBER,
   RBFLAG       NUMBER,
   RBSEQ        NUMBER,
   GROUPL1      DECIMAL(9),
   GROUPL2      DECIMAL(9),
   RBDBR        DECIMAL(9)
);

create unique index ifrm40_rbt on frm40__rbt(modid,itemid);

REM
REM create view FRM40_RBT as 
REM        select OWNER, MODID, ITEMID, PARENTID, RBNAME,
REM               RBLABELI, RBVALUE, RBVA, RBX, RBY, RBHT, RBWD, RBFLAG, RBSEQ,
REM               GROUPL1, GROUPL2, RBDBR
REM        from FRM40__RBT 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_RBT for system.FRM40__RBT;

create table FRM40__ALERT
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   ALNAME       VARCHAR(30),
   ALVA         NUMBER,
   ALMSGI       DECIMAL(9),
   ALBUT1I      DECIMAL(9),
   ALBUT2I      DECIMAL(9),
   ALBUT3I      DECIMAL(9),
   ALSTYLE      NUMBER,
   ALDEFBUT     NUMBER,
   ALFLAG       NUMBER
);

create unique index ifrm40_alert on frm40__alert(modid,itemid);

REM
REM create view FRM40_ALERT as 
REM        select OWNER, MODID, ITEMID, ALNAME, ALVA, ALMSGI, ALBUT1I,
REM               ALBUT2I, ALBUT3I, ALSTYLE, ALDEFBUT, ALFLAG
REM        from FRM40__ALERT 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_ALERT for system.FRM40__ALERT;

create table FRM40__LOVCOL
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   LCOLNAME     VARCHAR(30),
   LCOLTITLEI   DECIMAL(9),
   LCOLRETURN   VARCHAR(61),
   LCOLDWIDTH   NUMBER,
   LCOFLAG      NUMBER,
   LCOLSEQ      NUMBER
);

create unique index ifrm40_lovcol on frm40__lovcol(modid,itemid);

REM
REM create view FRM40_LOVCOL as 
REM        select OWNER, MODID, ITEMID, PARENTID, LCOLNAME, LCOLTITLEI,
REM               LCOLRETURN, LCOLDWIDTH, LCOFLAG, LCOLSEQ
REM        from FRM40__LOVCOL 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_LOVCOL for system.FRM40__LOVCOL;

create table FRM40__RGPCOL
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   RCOLNAME     VARCHAR(30),
   RCOLDTWIDTH  NUMBER,
   RCOLTYPE     NUMBER,
   RCOLFLAG     NUMBER,
   RCOLSEQ      NUMBER
);

create unique index ifrm40_rgpcol on frm40__rgpcol(modid,itemid);

REM
REM create view FRM40_RGPCOL as 
REM        select OWNER, MODID, ITEMID, PARENTID, RCOLNAME, RCOLDTWIDTH,
REM               RCOLTYPE, RCOLFLAG, RCOLSEQ
REM        from FRM40__RGPCOL 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_RGPCOL for system.FRM40__RGPCOL;

create table FRM40__LOV
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   LOVNAME      VARCHAR(30),
   LOVVA        DECIMAL(9),
   LOVOTXT      DECIMAL(9),
   LOVTITLEI    DECIMAL(9),
   LOVGROUP     VARCHAR(30),
   LOVX         NUMBER,
   LOVY         NUMBER,
   LOVWD        NUMBER,
   LOVHT        NUMBER,
   LOVFLAG      NUMBER
);

create unique index ifrm40_lov on frm40__lov(modid,itemid);

REM
REM create view FRM40_LOV as 
REM        select OWNER, MODID, ITEMID, LOVNAME, LOVVA, LOVOTXT, LOVTITLEI,
REM               LOVGROUP, LOVX, LOVY, LOVWD, LOVHT, LOVFLAG
REM        from FRM40__LOV 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_LOV for system.FRM40__LOV;

create table FRM40__EDITOR
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   EDNAME       VARCHAR(30),
   EDTTITLEI    DECIMAL(9),
   EDBTITLEI    DECIMAL(9),
   EDWINVA      DECIMAL(9),
   EDVA         DECIMAL(9),
   EDWRAP       NUMBER,
   EDX          NUMBER,
   EDY          NUMBER,
   EDH          NUMBER,
   EDWD         NUMBER,
   EDFLAG       NUMBER
);

create unique index ifrm40_editor on frm40__editor(modid,itemid);

REM
REM create view FRM40_EDITOR as 
REM        select OWNER, MODID, ITEMID, EDNAME, EDTTITLEI, EDBTITLEI, 
REM               EDWINVA, EDVA, EDWRAP, EDX, EDY, EDH, EDWD, EDFLAG
REM        from FRM40__EDITOR 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_EDITOR for system.FRM40__EDITOR;

create table FRM40__GRP
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   GRPNAME     VARCHAR(30),
   GRPFLAG     NUMBER
);

create unique index ifrm40_grp on frm40__grp(modid,itemid);

REM
REM create view FRM40_GRP as 
REM        select OWNER, MODID, ITEMID, GRPNAME, GRPFLAG
REM        from FRM40__GRP 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_GRP for system.FRM40__GRP;

create table FRM40__RGP
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   RGNAME      VARCHAR(30),
   RGQUERY     DECIMAL(9),
   RGFLAG      NUMBER
);

create unique index ifrm40_rgp on frm40__rgp(modid,itemid);

REM
REM create view FRM40_RGP as 
REM        select OWNER, MODID, ITEMID, RGNAME, RGQUERY, RGFLAG
REM        from FRM40__RGP 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_RGP for system.FRM40__RGP;

create table FRM40__FRMPAR
(
   OWNER      VARCHAR(30),
   MODID      NUMBER(9),
   ITEMID     NUMBER(9),
   PARNAME    VARCHAR(30),
   PARLEN     NUMBER,
   PARDTYPE   NUMBER,
   PARFLAG    NUMBER,
   PARDFLTI   DECIMAL(9)
);

create unique index ifrm40_frmpar on frm40__frmpar(modid,itemid);

REM
REM create view FRM40_FRMPAR as 
REM        select OWNER, MODID, ITEMID, PARNAME, PARLEN, PARDTYPE, PARFLAG, 
REM               PARDFLTI
REM        from FRM40__FRMPAR 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_FRMPAR for system.FRM40__FRMPAR;

create table FRM40__V2TRG
(
   OWNER       VARCHAR(30),
   MODID       NUMBER(9),
   PARENTID    NUMBER(9),
   ITEMID      NUMBER(9),
   V2SEQ       NUMBER,
   V2LABEL     VARCHAR(30),
   V2TXT       NUMBER(9),
   V2SLAB      VARCHAR(30),
   V2FLAB      VARCHAR(30),
   V2MSGI      DECIMAL(9),
   V2FLAG      NUMBER,
   GROUPL1     NUMBER(9),
   GROUPL2     NUMBER(9)
);

create index ifrm40_v2trg on frm40__v2trg(modid,parentid);

REM
REM create view FRM40_V2TRG as
REM    select OWNER, MODID, PARENTID, ITEMID, V2SEQ, V2LABEL, V2TXT, V2SLAB,
REM           V2FLAB, V2MSGI, V2FLAG, GROUPL1, GROUPL2
REM    from FRM40__V2TRG 
REM    where upper(owner) = upper(user) or 
REM    modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_V2TRG for system.FRM40__V2TRG;

create table FRM40__VA
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   VANAME      VARCHAR(30),
   VACDATTR    VARCHAR(30),
   VAFCOLOR    NUMBER,
   VABCOLOR    NUMBER,
   VAFPATTERN  NUMBER,
   VAROTANGLE  NUMBER,
   VATYPE      NUMBER,
   VAFFACE     VARCHAR(30),
   VAFSIZE     NUMBER,
   VAFSTYLE    NUMBER,
   VAFWEIGHT   NUMBER,
   VAFWIDTH    NUMBER,
   VAFECOLOR   NUMBER,
   VABECOLOR   NUMBER,
   VAEPATTERN  NUMBER,
   VABWIDTH    NUMBER,
   VADSTYLE    NUMBER,
   VACSTYLE    NUMBER,
   VAJSTYLE    NUMBER,
   VAFLAG      NUMBER
);

create unique index ifrm40_va on frm40__va(modid,itemid);

REM
REM create view FRM40_VA as 
REM        select OWNER, MODID, ITEMID, VANAME, VACDATTR, VAFCOLOR, VABCOLOR,
REM              VAFPATTERN, VAROTANGLE, VATYPE, VAFFACE, 
REM              VAFSIZE, VAFSTYLE, VAFWEIGHT, VAFWIDTH, VAFECOLOR, VABECOLOR, 
REM              VAEPATTERN, VABWIDTH, VADSTYLE, VACSTYLE, VAJSTYLE, 
REM              VAFLAG      
REM        from FRM40__VA 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_VA for system.FRM40__VA;

create table FRM40__VIEW
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   VCNAME      VARCHAR(30),
   VCWNAME     VARCHAR(30),
   VCVA        DECIMAL(9),
   VCX         NUMBER,
   VCY         NUMBER,
   VCWD        NUMBER,
   VCHT        NUMBER,
   VCSX        NUMBER,
   VCSY        NUMBER,
   VCPX        NUMBER,
   VCPY        NUMBER,
   VCBBEVEL    NUMBER,
   VCFLAG      NUMBER,
   VCSEQ       NUMBER
);

create unique index ifrm40_view on frm40__view(modid,itemid);

REM
REM create view FRM40_VIEW as 
REM        select OWNER, MODID, ITEMID, VCNAME, VCWNAME, VCVA, VCX, VCY, VCWD,
REM               VCHT, VCSX, VCSY, VCPX, VCPY, VCBBEVEL, VCFLAG, VCSEQ
REM        from FRM40__VIEW 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_VIEW for system.FRM40__VIEW;

create table FRM40__WINDOW
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   WINNAM      VARCHAR(30),
   WINX        NUMBER,
   WINY        NUMBER,
   WINWD       NUMBER,
   WINHT       NUMBER,
   WINVA       NUMBER,
   WINTITLEI   DECIMAL(9),
   WINICONTITI DECIMAL(9),
   WINMRX      NUMBER,
   WINMRY      NUMBER,
   WINXRX      NUMBER,
   WINXRY      NUMBER,
   WINRSX      NUMBER,
   WINRSY      NUMBER,
   WINICONNAME VARCHAR(30),
   WINCONTVW   VARCHAR(80),
   WINFLAG     NUMBER
);

create unique index ifrm40_window on frm40__window(modid,itemid);

REM
REM create view FRM40_WINDOW as 
REM        select OWNER, MODID, ITEMID, WINNAM, WINX, WINY, WINWD, WINHT,
REM               WINVA, WINTITLEI, WINICONTITI, WINMRX, WINMRY,
REM               WINXRX, WINXRY, WINRSX, WINRSY, WINICONNAME, 
REM               WINCONTVW, WINFLAG
REM        from FRM40__WINDOW 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_WINDOW for system.FRM40__WINDOW;

create table FRM40__NAMELIST
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   PARENTID    DECIMAL(9),
   NLNAMEI     DECIMAL(9),
   NLVAL       VARCHAR(80),
   NLPTYPE     NUMBER,
   NLFLAG      NUMBER,
   NLSEQ       NUMBER,
   GROUPL1     DECIMAL(9),
   GROUPL2     DECIMAL(9)
);

create unique index ifrm40_namelist on frm40__namelist(modid,itemid);

REM
REM create view FRM40_NAMELIST as 
REM        select OWNER, MODID, ITEMID, PARENTID, NLNAMEI, NLPTYPE, NLFLAG, 
REM               NLSEQ, NLVAL, GROUPL1, GROUPL2
REM        from FRM40__NAMELIST 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_NAMELIST for system.FRM40__NAMELIST;

create public synonym FRM40__NAMELIST for system.FRM40__NAMELIST;

grant select on FRM40__NAMELIST to public;

create table FRM40__VS
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   VSCDEVATT    VARCHAR(30),
   VSPPALNAME   VARCHAR(30),
   VSFPALNAME   VARCHAR(30),
   VSBPALNAME   VARCHAR(30),
   VSFONTFACE   VARCHAR(30),
   VSFONTSIZE   NUMBER,
   VSFONTSTY    NUMBER,
   VSFONTWT     NUMBER,
   VSFONTWD     NUMBER,
   VSFGCOLOR    NUMBER,
   VSBGCOLOR    NUMBER,
   VSFILLPAT    NUMBER,
   VSFECOLOR    NUMBER,
   VSBECOLOR    NUMBER,
   VSEPAT       NUMBER,
   VSBRWD       NUMBER,
   VSDASHST     NUMBER,
   VSCAPST      NUMBER,
   VSJOINST     NUMBER,
   VSRANGLE     NUMBER,
   VSARTYPE     NUMBER,
   VSACMODE     NUMBER,
   VSAFMODE     NUMBER,
   VSHJSTY      NUMBER,
   VSVJSTY      NUMBER
);

create unique index ifrm40_vs on frm40__vs(modid,parentid);

REM
REM create view FRM40_VS as 
REM select OWNER, MODID, ITEMID, PARENTID, VSCDEVATT, VSPPALNAME,
REM           VSFPALNAME, VSBPALNAME, VSFONTFACE, VSFONTSIZE,
REM           VSFONTSTY, VSFONTWT, VSFONTWD, VSFGCOLOR, VSBGCOLOR,
REM           VSFILLPAT, VSFECOLOR, VSBECOLOR, VSEPAT, VSBRWD,
REM           VSDASHST, VSCAPST, VSJOINST, VSRANGLE, VSARTYPE,
REM           VSACMODE, VSAFMODE, VSHJSTY, VSVJSTY
REM    from FRM40__VS 
REM    where upper(owner) = upper(user) or 
REM    modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_VS for system.FRM40__VS;

create table FRM40__SB
(
   OWNER        VARCHAR(30),
   MODID        DECIMAL(9),
   ITEMID       DECIMAL(9),
   PARENTID     DECIMAL(9),
   SBMCANVAS    NUMBER,
   SBMVA        NUMBER,
   SBMFLAG      NUMBER,
   SBMSEQ       NUMBER,
   SBMX         NUMBER,
   SBMY         NUMBER,
   SBMWD        NUMBER,
   SBMHT        NUMBER,
   SBIDT        DECIMAL(9)
);

create unique index ifrm40_sb on frm40__sb(modid,itemid);

REM
REM create view FRM40_SB as
REM        select OWNER, MODID, ITEMID, PARENTID, SBMCANVAS, SBMVA,
REM               SBMFLAG, SBMSEQ, SBMX, SBMY, SBMWD, SBMHT, SBIDT
REM        from FRM40__SB
REM        where upper(owner) = upper(user) or
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_SB for system.FRM40__SB;

create table FRM40__LIBEXTLOC
(
  OWNER       VARCHAR(30),
  MODID       DECIMAL(9),
  ORDERNO     DECIMAL(9),
  EXTLOC      VARCHAR(255),
  LIBNAME     VARCHAR(30),
  FILENAME    VARCHAR(30),
  SOURCE      DECIMAL(1)
);

create unique index ifrm40_libextloc  on frm40__libextloc(modid,orderno);

REM
REM create view FRM40_LIBEXTLOC as
REM    select OWNER, MODID, ORDERNO, EXTLOC, LIBNAME, FILENAME 
REM    from FRM40__LIBEXTLOC where upper(owner) = upper(user) or 
REM    modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_LIBEXTLOC for system.FRM40__LIBEXTLOC;

create table FRM40__MNUAPP
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   APPNAME     VARCHAR(30),
   APPSNAME    VARCHAR(15),
   APPFNAME    VARCHAR(30),
   APPCREDATE  DATE,
   APPCREATOR  VARCHAR(30),
   APPVRNUM    DECIMAL(6),
   APPLRDATE   DATE,
   APPDIR      VARCHAR(50),
   APPIDTI     DECIMAL(9),
   APPOBJNUM   NUMBER,
   APPSMENU    VARCHAR(30),
   APPCSEG     DECIMAL(9),
   APPSSEG     DECIMAL(9),
   APPFLAG     NUMBER,
   APPNLSLANG  VARCHAR(40)
);

create unique index ifrm40_mnuapp on frm40__mnuapp(modid,itemid);

REM
REM create view FRM40_MNUAPP as 
REM select OWNER, MODID, ITEMID, APPNAME, APPSNAME, APPFNAME,
REM               APPCREDATE, APPCREATOR, APPVRNUM, APPLRDATE, APPDIR,
REM               APPIDTI, APPOBJNUM, APPSMENU, APPCSEG, APPSSEG,
REM               APPFLAG, APPNLSLANG
REM        from FRM40__MNUAPP 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_MNUAPP for system.FRM40__MNUAPP;
create public synonym FRM40__MNUAPP for system.FRM40__MNUAPP;

grant select on FRM40__MNUAPP to public;

create table FRM40__MNUMNU
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   MNUNAME     VARCHAR(30),
   MNUTITLEI   DECIMAL(9),
   MNUSTITLEI  DECIMAL(9),
   MNUBTITLEI  DECIMAL(9),
   MNUFLAG     NUMBER
);
 
create unique index ifrm40_mnumnu on frm40__mnumnu(modid,itemid);

REM
REM create view FRM40_MNUMNU as 
REM        select OWNER, MODID, ITEMID, MNUNAME, MNUTITLEI, MNUSTITLEI, 
REM               MNUBTITLEI, MNUFLAG
REM        from FRM40__MNUMNU 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_MNUMNU for system.FRM40__MNUMNU;

create table FRM40__MNUITM
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   PARENTID    DECIMAL(9),
   ITMNAMEI    DECIMAL(9),
   ITMTXT      VARCHAR(80),
   ITMRGN      VARCHAR(30),
   ITMICN      VARCHAR(30),
   ITMAKEY     VARCHAR(30),
   ITMCMD      DECIMAL(9),
   ITMHELP     DECIMAL(9),
   ITMVA       DECIMAL(9),
   ITMSEQ      NUMBER,
   ITMTYPE     NUMBER,
   ITMCTYPE    NUMBER,
   ITMFLAG     NUMBER,
   ITMNAME     VARCHAR(50),
   ITMTXTI     DECIMAL(9)
);

create unique index ifrm40_mnuitm on frm40__mnuitm(modid,itemid);
create index ifrm40_mnuitm2 on frm40__mnuitm(modid,parentid);

REM
REM create view FRM40_MNUITM as 
REM        select OWNER, MODID, ITEMID, PARENTID, ITMNAMEI, ITMTXT,
REM               ITMRGN, ITMICN, ITMAKEY, ITMCMD, ITMHELP, ITMVA, ITMSEQ, 
REM               ITMTYPE, ITMCTYPE, ITMFLAG, ITMNAME, ITMTXTI
REM        from FRM40__MNUITM 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_MNUITM for system.FRM40__MNUITM;

create table FRM40__MNUPAR
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   PARNAME     VARCHAR(30),
   PARDFLTI    DECIMAL(9),
   PARHINTI    DECIMAL(9),
   PARPROMPTI  DECIMAL(9),
   PARLEN      NUMBER,
   PARCASE     NUMBER,
   PARFLAG     NUMBER
);

create unique index ifrm40_mnupar on frm40__mnupar(modid,itemid);

REM
REM create view FRM40_MNUPAR as 
REM        select OWNER, MODID, ITEMID, PARNAME, PARDFLTI, PARHINTI, PARPROMPTI,
REM               PARLEN, PARCASE, PARFLAG
REM        from FRM40__MNUPAR 
REM        where upper(owner) = upper(user) or 
REM        modid in ( select modid from tool_accessible );
REM

create public synonym FRM40_MNUPAR for system.FRM40__MNUPAR;

create table FRM40__MNUUSER
(
    GRPID      NUMBER,
    USERNAME  VARCHAR(30)
);

create index ifrm40_mnuuser on frm40__mnuuser(grpid);
create index ifrm40_mnuuser1 on frm40__mnuuser(username);

REM
REM create view FRM40_MNUUSER as
REM         select GRPID, USERNAME from FRM40__MNUUSER;
REM

create public synonym FRM40_MNUUSER for system.FRM40__MNUUSER;

create table FRM40__MNUGRP
(
   GRPID       NUMBER,
   GRPNAME     VARCHAR(30),
   GRPFLG      NUMBER,
   GRPCMT      LONG,
   CMTLEN      NUMBER
);

create unique index ifrm40_mnugrp on frm40__mnugrp(grpid);

REM
REM create view FRM40_MNUGRP as 
REM        select GRPID, GRPNAME, GRPFLG, GRPCMT, CMTLEN from
REM FRM40__MNUGRP;
REM

create public synonym FRM40_MNUGRP for system.FRM40__MNUGRP;

REM
REM Version number of this script
REM
delete from tool_module where product = 'SQL*Forms' and modid = 0;
delete from tool_access where product = 'SQL*Forms' and modid = 0;

insert into tool_module values
( 'SQL*Forms', '', 0, 0, 'SYSTEM', '', 'SYSTEM', '14-SEP-93', 40000029,
  'SYSTEM', '14-SEP-93', 40000029, '', '', 20014, 0, 0, 0);

insert into tool_access values
( 'SQL*Forms', 'SYSTEM', 0, 'PUBLIC');

Commit;
