MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/sdowfsmd.sql /main/48 2017/07/10 11:24:16 sravada Exp $
Rem
Rem sdowfsmd.sql
Rem
Rem Copyright (c) 2004, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem sdowfsmd.sql - <one-line expansion of the name>
Rem
Rem DESCRIPTION
Rem <short description of component this file declares/defines>
Rem
Rem NOTES
Rem <other useful comments, qualifications, etc.>
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/sdowfsmd.sql
Rem SQL_SHIPPED_FILE: md/admin/sdowfsmd.sql
Rem SQL_PHASE: SDOWFSMD
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/sdowfscs.sql
Rem END SQL_FILE_METADATA
Rem
Rem MODIFIED (MM/DD/YY)
Rem sravada 07/06/17 - move types here from sdowfscs
Rem rjanders 05/10/17 - #26037683: Raise 'when other' exceptions
Rem rjanders 03/23/17 - #25437999: Remove 'when others then NULL'
Rem handlers
Rem rjanders 03/09/17 - Add missing SQL_FILE_METADATA information
Rem sravada 01/11/17 - bug 25370681
Rem lramosc 02/05/16 - Reduce wfs datasouces to one.
Rem bkazar 11/21/15 - bug-22242553
Rem rjanders 11/20/15 - #21930978: Correct MDSYS.WFS_FeatureType$ defn
Rem rjanders 01/02/15 - long identifier project phase 1
Rem rjanders 09/16/13 - OCCS: Remove hardtabs
Rem rjanders 03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem initialization
Rem bkazar 10/12/12 - Bug 14756954
Rem bkazar 05/12/10 - modify WFS_FeatureTypeTags$ table (for WFS 1.1)
Rem bkazar 09/01/09 - fixing WFS_CapabilitiesInfo$ for upgrade
Rem bkazar 08/26/09 - modify WFS_FeatureType$ table (for WFS 1.1)
Rem bkazar 07/09/09 - modify WFS_CapabilitiesInfo$ table (for WFS 1.1)
Rem rchatter 12/27/05 - update WFS_featureTableMDUpdated
Rem rchatter 10/11/05 - make md table names internal
Rem rchatter 09/16/05 - add SPATIALPATHARRSEP
Rem rchatter 08/30/05 - update Feature metadata table
Rem rchatter 07/19/05 - modify capability related metadata
Rem rchatter 06/28/05 - modify column metadata
Rem rchatter 05/26/05 - add timestamp path metadata
Rem rchatter 05/18/05 - add cache data sync related tables
Rem rchatter 05/10/05 -
Rem rchatter 04/26/05 - add compound key metadata for doc based
Rem feature types
Rem rchatter 04/22/05 - modify capability related metadata
Rem rchatter 04/06/05 - add metadata table for nested sdo geom objects
Rem rchatter 04/04/05 - add metadata for xmltype col support
Rem rchatter 03/30/05 - extend WFS_FeatureType
Rem rchatter 03/18/05 - add support doc-based featuretype
Rem rchatter 03/08/05 - add support for varrays/nested_tables
Rem rchatter 01/11/05 - add capability related metadata
Rem rchatter 01/04/05 - add feature type tag attr table
Rem rchatter 12/27/04 - add FeatureType Attr table
Rem rchatter 12/21/04 - rchatter_wfs_impl_txn_1
Rem rchatter 12/21/04 - Created
Rem
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************
Rem ********************************************************************
SELECT 'Spatial WFS ...' "Msg" FROM SYS.DUAL;
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
alter session set current_schema=mdsys;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'STRINGLIST';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.StringList is varray(1000000) of varchar2(4000)';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.StringList to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'STRINGLISTLIST';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.StringListList as varray(1000000) OF StringList';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.StringListList to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'ROWPOINTERLIST';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.RowPointerList is table of varchar2(4000)';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.RowPointerList to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
compilation_error exception;
pragma exception_init(compilation_error, -22324);
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'WFSCOMPLEXTYPE';
begin
if(rec_count = 0) then
stmt := ' create or replace type mdsys.WfscomplexType as object ( ns varchar2(30), name varchar2(30))';
execute immediate stmt;
end if;
stmt := ' alter type mdsys.WfscomplexType modify attribute ( ns varchar2(128), name varchar2(128) ) cascade including table data';
execute immediate stmt;
exception
when compilation_error then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfscs.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
end;
end;
/
grant execute on mdsys.WfscomplexType to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'SDO_GEOM_PATH_ELEM';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.sdo_geom_path_elem as object ( path mdsys.StringList, geom mdsys.sdo_geometry, arrIndex number )';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.sdo_geom_path_elem to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'SDO_GEOM_PATH_INFO';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.sdo_geom_path_info as table of mdsys.sdo_geom_path_elem';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.sdo_geom_path_info to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'SDO_GEOM_PATH_INFO_ELEM';
begin
if(rec_count = 0) then
-- 257=2x128 + '.'
stmt := ' create or replace type mdsys.sdo_geom_path_info_elem as object (pathInfo mdsys.sdo_geom_path_info, pkcol varchar2(4000), tableName varchar2(61))';
execute immediate stmt;
end if;
exception when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfscs.sql(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); RAISE;
end;
end;
/
grant execute on mdsys.sdo_geom_path_info_elem to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'SDO_GEOM_PATH_INFO_LIST';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.sdo_geom_path_info_list as table of mdsys.sdo_geom_path_info_elem';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.sdo_geom_path_info_list to public;
declare
stmt VARCHAR2(10000);
compilation_error exception;
pragma exception_init(compilation_error, -22324);
begin
begin
/* alter the type now */
stmt := ' alter type mdsys.sdo_geom_path_info_elem modify attribute (tableName varchar2(257)) cascade including table data';
execute immediate stmt;
exception
when compilation_error then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfscs.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); RAISE;
end;
end;
/
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TYPES where owner = 'MDSYS' and type_name = 'SDONUMLIST';
if(rec_count = 0) then
stmt := ' create or replace type mdsys.SDONUMLIST is table of number';
execute immediate stmt;
end if;
end;
/
grant execute on mdsys.SDONUMLIST to public;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
key_exists exception;
pragma exception_init(key_exists, -02261);
column_exists exception;
pragma exception_init(column_exists, -01430);
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPE$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureType$(featureTypeId number primary key,
featureTypeName varchar2(80),
featureDesc XMLType, -- conforming to FeatureTypeType xsd
describeFeatureType XMLType, -- for any xsd for describe Feature Type
-- this field could be automatically populated
-- and materialized for each feature type from
-- the feature instance table definition.
lastDescribeFeatureTypeGenTS timestamp(6),
lastFeatureUpdateTS timestamp(6),
namespacePrefix varchar2(20),
namespaceUrl varchar2(2083),
schemaLocation varchar2(2083),
keyCols varchar2(4000),
dataPointer varchar2(61), -- pointer to the instance storage for this type
isDocBased varchar2(1),
spatialCols StringList,
mandatoryCols StringList,
tsCols StringList,
docIdPaths StringList,
spatialPathArrSep StringList,
primarySpatialCol varchar2(4000),
featureMemberName varchar2(2200),
srsNs varchar2(2083),
srsNsAlias varchar2(80),
ftXSDRefId varchar2(80),
isMTableView varchar2(1),
vTableList mdsys.StringList,
vKeyColsList mdsys.StringList ,
tKeyColsList mdsys.StringList ,
numCols mdsys.StringList ,
idxPaths mdsys.StringList ,
idxPathTypes mdsys.StringList,
xtidxCreated varchar2(1),
featureCollectionName varchar2(2200),
formattedkeyCols mdsys.StringList,
formattedtkeyColList mdsys.StringListList,
isGML3 varchar2(1),
spatialArrList mdsys.StringListList,
spatialPathsSRSNSList mdsys.StringListList,
spatialArrPathsSRSNSList mdsys.StringListList
) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create table MDSYS.WFS_FeatureType$ ERROR=' || SQLERRM);
end;
stmt := 'alter table MDSYS.WFS_FeatureType$
modify ( dataPointer varchar2(257) ) ';
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'alter table MDSYS.WFS_FeatureType$ ERROR=' || SQLERRM);
end;
stmt := ' alter table MDSYS.WFS_FeatureType$ add constraint unique_wfs_ft_cond UNIQUE (namespaceUrl, featureTypeName) ';
begin
execute immediate stmt;
exception
when key_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfsmd.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
end;
stmt := ' alter table MDSYS.WFS_FeatureType$ add (WFS_VERSION VARCHAR2(20)) '; -- updated when new version of WFS is supported.
begin
execute immediate stmt;
exception
when column_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfsmd.sql(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); RAISE;
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
column_exists exception;
pragma exception_init(column_exists, -01430);
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPETAGS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeTags$ (featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
tagName varchar2(80),
tagSeqNo integer,
tagType varchar2(80),
tagTypeNsUrl varchar2(2083),
columnName varchar2(128),
isNullable varchar2(1),
dataLength number,
isMandatory varchar2(1),
dbTypeName varchar2(80))';
else
stmt :=
' alter table MDSYS.WFS_FeatureTypeTags$
modify ( columnName varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create/alter table MDSYS.WFS_FeatureTypeTags$ ERROR=' || SQLERRM);
end;
begin
stmt := ' alter table MDSYS.WFS_FeatureTypeTags$ add (ftVaryingNSAlias varchar2(123)) '; -- updated when new version of WFS is supported.
execute immediate stmt;
exception
when column_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfsmd.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); RAISE;
end;
begin
execute immediate
' alter table MDSYS.WFS_FeatureTypeTags$
modify ( columnName varchar2(128) ) ';
exception
when column_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'alter table MDSYS.WFS_FeatureTypeTags$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATUREINSTANCEMETADATA$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureInstanceMetadata$(featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
FeatureId varchar2(80),
isLocked varchar2(1),
lockExpiry number,
lockAcquireTime Timestamp,
lockId varchar2(80))';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
column_exists exception;
pragma exception_init(column_exists, -01430);
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_CAPABILITIESINFO$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_CapabilitiesInfo$(
lastCapabilityInfoUpdTS timestamp(6), -- updated when any capability related metadata is updated
CAPABILITIESINFOTMPL XMLType)'; -- updated when any capability info (in xml) is generated
execute immediate stmt;
end if;
begin
stmt :=
'alter table MDSYS.WFS_CapabilitiesInfo$ add (WFS_VERSION VARCHAR2(20))'; -- updated when new version of WFS is supported.
execute immediate stmt;
exception
when column_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfsmd.sql(' || $$PLSQL_LINE || ')4]: ' || SQLERRM); RAISE;
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPECOMPLEXTAGS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeComplexTags$ (xml_typename varchar2(80),
xml_typenameNsUrl varchar2(2083),
xml_typetagname varchar2(80),
xml_typetagseqno integer,
xml_typetagtype varchar2(80),
xml_typetagtypeNsUrl varchar2(2083),
db_attrname varchar2(80),
db_attrtype varchar2(80),
isNullable varchar2(1),
dataLength number,
db_arrtype varchar2(80), -- this is populated only for collection types
isArrayType varchar2(1),
arrLength number)'; -- -1 for nested_tables
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPEATTRS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeAttrs$ (featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
attrName varchar2(80),
attrSeqNo integer,
attrType varchar2(80),
attrTypeNsUrl varchar2(2083),
columnName varchar2(128),
isNullable varchar2(1),
dataLength number,
isMandatory varchar2(1),
dbTypeName varchar2(80))';
else
stmt :=
' alter table MDSYS.WFS_FeatureTypeAttrs$
modify ( columnName varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create/alter table MDSYS.WFS_FeatureTypeAttrs$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPESIMPLETAGATTRS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeSimpleTagAttrs$ (featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
tagName varchar2(80),
attrName varchar2(80),
attrSeqNo integer,
attrType varchar2(80),
attrTypeNsUrl varchar2(2083),
columnName varchar2(128),
isNullable varchar2(1),
dataLength number,
isMandatory varchar2(1),
dbTypeName varchar2(80))';
else
stmt :=
' alter table MDSYS.WFS_FeatureTypeSimpleTagAttrs$
modify ( columnName varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'alter table MDSYS.WFS_FeatureTypeSimpleTagAttrs$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FTTYPECOMPLEXTAGATTRS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FtTypeComplexTagAttrs$ (xml_typename varchar2(80),
xml_typenameNsUrl varchar2(2083),
xml_typetagname varchar2(80),
attrName varchar2(80),
attrSeqno integer,
attrType varchar2(80),
attrTypeNsUrl varchar2(2083),
db_attrname varchar2(80),
db_attrtype varchar2(80),
isNullable varchar2(1),
dataLength number)';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_PROC_MAP$';
if(rec_count = 0) then
stmt := 'create table MDSYS.WFS_PROC_MAP$ (ARRTYPENAME varchar2(80),
PACKAGENAME varchar2(128))';
else
stmt :=
' alter table MDSYS.WFS_PROC_MAP$
modify ( PACKAGENAME varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create/alter table MDSYS.WFS_PROC_MAP$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPEXMLCOLINFO$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeXMLCOLINFO$(id number primary key,
featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
ftnamespaceUrl varchar2(2083),
xsdDesc xmltype,
xsdWrapperDesc xmltype, -- generated derived col
columnName varchar2(128),
objpathInfo MDSYS.StringList,
lastUpdateTS timestamp(6),
lastWrapperGenerateTS timestamp(6)) ';
else
stmt :=
' alter table MDSYS.WFS_FeatureTypeXMLCOLINFO$
modify ( columnName varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create/alter table MDSYS.WFS_FeatureTypeXMLCOLINFO$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETYPENESTEDSDOS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_FeatureTypeNestedSDOs$(
featureTypeId number references MDSYS.WFS_FeatureType$(featureTypeId) on delete cascade,
objnamespace varchar2(128),
objName varchar2(128),
objNameIndex number) ';
else
stmt :=
' alter table MDSYS.WFS_FeatureTypeNestedSDOs$
modify ( objnamespace varchar2(128),
objName varchar2(128) ) ';
end if;
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'create/alter table MDSYS.WFS_FeatureTypeNestedSDOs$ ERROR=' || SQLERRM);
end;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETABLEMDUPDATED$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_featureTableMDUpdated$(
featureTypeNSUrl varchar2(2083),
featureTypeName varchar2(80),
updateTS timestamp(6)) ';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FEATURETABLEUPDATED$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_featureTableUpdated$(
featureTypeNSUrl varchar2(2083),
featureTypeName varchar2(80),
rowList RowPointerList,
updateTS timestamp(6)) nested table rowList store as r_table ';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_FTXSDINFO$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_ftXSDInfo$(
ftXSDRefId varchar2(80) primary key,
ftDef XMLType) ';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_SRS$';
if(rec_count = 0) then
stmt :=
'create table MDSYS.WFS_Srs$(featureTypeId number,
customSrsNamePrefixes varchar2(4000),
defaultSrs varchar2(4000),
otherSrss mdsys.StringList) ';
execute immediate stmt;
end if;
end;
/
SHOW ERRORS
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'CURRENTSESSIONTOKENMAP_T$';
if(rec_count = 0) then
stmt := ' create table MDSYS.CurrentSessionTokenMap_t$ (sessionId varchar2(128), tokenId varchar2(100) , primary key(sessionId, tokenId))';
else
stmt := ' alter table MDSYS.CurrentSessionTokenMap_t$ modify ( sessionId varchar2(128) ) ';
end if;
execute immediate stmt;
stmt := ' create or replace view MDSYS.CurrentSessionTokenMap$ as select sessionId , tokenId from MDSYS.CurrentSessionTokenMap_t$ where sessionId in (select dbms_session.unique_session_id from SYS.DUAL)';
execute immediate stmt;
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'TOKENSESSIONMAP_T$';
if(rec_count = 0) then
stmt := ' create table MDSYS.TokenSessionMap_t$ (sessionId varchar2(128), tokenId varchar2(100) unique, expiryTime timestamp(6), expiryOffset number, primary key(sessionId, tokenId))';
else
stmt := ' alter table MDSYS.TokenSessionMap_t$ modify ( sessionId varchar2(128) ) ';
end if;
execute immediate stmt;
stmt := ' create or replace view MDSYS.TokenSessionMap$ as select sessionId , tokenId , expiryTime, expiryOffset from MDSYS.TokenSessionMap_t$ where (tokenId in (select tokenId from MDSYS.CurrentSessionTokenMap$ where sessionId in (select dbms_session.unique_session_id from SYS.DUAL))) or expiryTime < sysdate';
execute immediate stmt;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'ROWTOKENMAP_T$';
if(rec_count = 0) then
stmt := ' create table MDSYS.RowTokenMap_t$ (tokenId varchar2(100) references TokenSessionMap_t$(tokenId) on delete cascade, tableName varchar2(61), rpointer ROWID, markedDeleted varchar2(1) default NULL)';
execute immediate stmt;
begin
stmt := ' alter table MDSYS.RowTokenMap_t$ add constraint unique_rowtokenmap_cond UNIQUE (tableName, rpointer) ';
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfspr.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
end;
end if;
stmt := 'alter table MDSYS.RowTokenMap_t$ modify ( tableName varchar2(257) )';
begin
execute immediate stmt;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdowfspr.sql(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); RAISE;
end;
stmt := ' create or replace view MDSYS.RowTokenMap$ as select tokenId , tableName , rpointer , markedDeleted from MDSYS.RowTokenMap_t$ where tokenId in (select tokenId from mdsys.TokenSessionMap$) ';
execute immediate stmt;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_SEQUENCES where SEQUENCE_OWNER= 'MDSYS' and sequence_name = 'TOKEN_SQ$';
if(rec_count = 0) then
stmt := ' CREATE SEQUENCE MDSYS.token_sq$ START WITH 1 NOCACHE';
execute immediate stmt;
else
stmt := ' drop sequence MDSYS.token_sq$ ';
execute immediate stmt;
stmt := ' CREATE SEQUENCE MDSYS.token_sq$ START WITH 1 NOCACHE';
execute immediate stmt;
end if;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_SEQUENCES where SEQUENCE_OWNER = 'MDSYS' and sequence_name = 'FT_SQ$';
if(rec_count = 0) then
stmt := ' CREATE SEQUENCE MDSYS.ft_sq$ START WITH 1 NOCACHE';
execute immediate stmt;
else
stmt := ' drop sequence MDSYS.ft_sq$ ';
execute immediate stmt;
stmt := ' CREATE SEQUENCE MDSYS.ft_sq$ START WITH 1 NOCACHE ';
execute immediate stmt;
end if;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_SEQUENCES where SEQUENCE_OWNER = 'MDSYS' and sequence_name = 'XMLINFO_SQ$';
if(rec_count = 0) then
stmt := ' CREATE SEQUENCE MDSYS.xmlinfo_sq$ START WITH 1 NOCACHE';
execute immediate stmt;
else
stmt := ' drop sequence MDSYS.xmlinfo_sq$ ';
execute immediate stmt;
stmt := 'CREATE SEQUENCE MDSYS.xmlinfo_sq$ START WITH 1 NOCACHE ';
execute immediate stmt;
end if;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_SEQUENCES where SEQUENCE_OWNER = 'MDSYS' and sequence_name = 'WFS_PROC_SQ$';
if(rec_count = 0) then
stmt := ' CREATE SEQUENCE MDSYS.wfs_proc_sq$ START WITH 1 NOCACHE';
execute immediate stmt;
else
stmt := ' drop sequence MDSYS.wfs_proc_sq$ ';
execute immediate stmt;
stmt := ' CREATE SEQUENCE MDSYS.wfs_proc_sq$ START WITH 1 NOCACHE ';
execute immediate stmt;
end if;
end;
/
show errors;
declare
stmt VARCHAR2(10000);
rec_count NUMBER;
begin
select count(*) into rec_count from SYS.ALL_TABLES where owner = 'MDSYS' and table_name = 'WFS_TRG_TABLE_TEMP$';
if(rec_count = 0) then
stmt := 'create table wfs_trg_table_temp$ (r rowid)' ;
execute immediate stmt;
end if;
end;
/
show errors;
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO