Rem
Rem  NAME
Rem    frm60bld.sql - FoRMs 6.0 BuiLD tables and views
Rem
Rem  DESCRIPTION
Rem    Builds the table and view definitions for Forms 6.0
Rem
Rem  COPYRIGHT  
Rem    Copyright (c) 1991 by Oracle Corporation
Rem

create table FRM50__OBJECT
(
   OWNER         VARCHAR2(32),
   MODID         NUMBER(9),
   ITEMID        NUMBER,
   NAME          VARCHAR2(32),
   OBJECTTYPE    NUMBER,
   SEQUENCE      NUMBER,
   RAWLEN        NUMBER,
   TEXTLEN       NUMBER,
   CHUNKNO       NUMBER,
   SCOPEID       NUMBER,
   SCOPE1        VARCHAR2(32),
   SCOPE2        VARCHAR2(32),
   SCOPE3        VARCHAR2(32),
   RAWDATA       RAW(250),
   TEXTDATA1     VARCHAR2(2000),
   TEXTDATA2     VARCHAR2(2000),
   TEXTDATA3     VARCHAR2(2000),
   TEXTDATA4     VARCHAR2(2000),
   PROGRAMUNITID NUMBER
);
create index ifrm50_object on frm50__object(modid,itemid);
create public synonym FRM50_OBJECT for system.FRM50__OBJECT;

create table FRM50__BUFFER
(
   OWNER        VARCHAR2(32),
   MODID        NUMBER(9),
   STARTADDR    NUMBER,
   STARTREF     NUMBER,
   DATATYPE     NUMBER,
   LONGID       NUMBER
);
create index ifrm50_buffer on frm50__buffer(modid);
create public synonym FRM50_BUFFER for system.FRM50__BUFFER;

create table FRM50__BINDVAR
(
   OWNER        	VARCHAR2(32),
   MODID        	NUMBER(9),
   ITEMID      		NUMBER,
   NEXTBPOS     	NUMBER,
   PLSQLBV_EP   	NUMBER,
   TOTAL_BINDVAR	NUMBER
);
create index ifrm50_bindvar on frm50__bindvar(modid, itemid);
create public synonym FRM50_BINDVAR for system.FRM50__BINDVAR;


create table FRM50__GRP
(
   OWNER       VARCHAR(30),
   MODID       DECIMAL(9),
   ITEMID      DECIMAL(9),
   GRPNAME     VARCHAR(30),
   GRPFLAG     NUMBER
);
create unique index iFRM50_grp on FRM50__grp(modid,itemid);
create public synonym FRM50_GRP for system.FRM50__GRP;

create or replace view FRM50_ENABLED_ROLES as
select urp.granted_role role,
sum(distinct decode(rrp.granted_role,
   'ORAFORMS$OSC',2,
   'ORAFORMS$BGM',4,
   'ORAFORMS$DBG',1,0)) flag
from  sys.user_role_privs urp, role_role_privs rrp
where urp.granted_role = rrp.role (+)
  and urp.granted_role not like 'ORAFORMS$%'
group by urp.granted_role;

create public synonym FRM50_ENABLED_ROLES for system.FRM50_ENABLED_ROLES;

create role ORAFORMS$OSC;
create role ORAFORMS$DBG;
create role ORAFORMS$BGM;





