Код:
SUPERMAG/qqq@AZS
WHENEVER SQLERROR EXIT 1 ROLLBACK;
WHENEVER OSERROR EXIT 2 ROLLBACK;
create or replace
view SUPERMAG_SESSIONS as select * from SYS.V_$SESSION
where status<>'KILLED';
CREATE TABLE SSMessages
(
ErrCode number(10) not null primary key,
MsgText varchar2(4000) not null,
constraint SSMessages_BadCode check(ErrCode between -20999 and -20000)
);
CREATE TABLE SSLocks
(
ObjType char(2) not null,
ID varchar2(150) not null,
SID number not null,
SERNUM number not null,
LockLabel varchar2(255) null,
TimePoint DATE default(sysdate) not null,
ClientProc number null,
constraint SSLocks_PK
primary key (ObjType,ID),
constraint SSCLocks_Proc
check(ObjType='CP' or ClientProc is not null)
);
CREATE TABLE SSObjectTypes
(
ObjType char(2) not null,
TypeName varchar2(100) not null,
ShortName varchar2(100) null,
IsDocument char(1) not null,
PostLevel number(5) default(2) not null,
constraint SSCObjectTypes_PK
primary key(ObjType),
constraint SSCObjectTypes_PostLvl
check(PostLevel between 0 and 2)
);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DB','База данных','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CF','Конфигурация базы данных','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('MR','Правила почтовой рассылки','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RB','База отчетов','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RF','Справочник','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PT','Почтовый модуль','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CP','Пользовательская сессия','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CM','Кассовый модуль','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('LK','Критическая секция','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SI','Пункт спецификации','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('UP','Упаковка','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DT','Тип дисконтной карты','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DC','Дисконтная карта','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DR','Скидки по типам дисконтных карт для артикулов','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DI','Скидки по дисконтным картам для артикулов','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('XC','Наценки по группам товаров','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('XA','Наценки по карточкам','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('GL','Уровни складских запасов','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('LP','Локальное ценообразование','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RV','Переоценки','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RA','Максимальные переоценки','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RI','Минимальные переоценки','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('XD','Скидки по группам товаров','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('LD','Пределы скидок по группам товаров','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('BP', 'Параметры дифференцированного ценообразования по маркетинговым группам', '0', 2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RR', 'Правила округления цен для карточек', '0', 2);
insert into SSObjectTypes(ObjType,TypeName,ShortName,IsDocument,PostLevel)
values('CD','Карточка складского учета','Карточка','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('BC','Штриховой код','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SH','Склад или магазин','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DG','Группа отделов','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('DU','Отдел','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SC','Кассир','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SS','Продавец-консультант','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('TO','Оператор ТСД','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PZ','Производственный участок','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CL','Клиент или поставщик','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AS','Артикул поставщика','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RG','Группа отчётов','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CZ','Кассовый отчет','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RQ','Удаленная команда','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PS','Должность','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('CH','Кассовый чек','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('FT','Свойства для артикулов','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PU','Список PLU для весов','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SP','План цен','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('OA','Массив объектов','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AP','Типы ценников для артикулов','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AI','Дополнительная информация для ценников','0',2);
insert into SSObjectTypes(ObjType, TypeName, IsDocument, PostLevel)
values('PR', 'Штриховой код с ценой', '0', 0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AT','Активность покупателя','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AX','Активность покупателя детальная','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AO','Активность покупателя оперативная','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('AY','Активность покупателя оперативная детальная','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SY','Запрос на синхронизацию баз данных','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PC','Процесс','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('BX','Короб','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('SA','Сервер приложений','0',0);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('RC','Остаток на складе закрытого периода','0',1);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('S1','Заказ от покупателя SAP','0',2);
insert into SSObjectTypes(ObjType,TypeName,IsDocument,PostLevel)
values('PG','Планограмма','0',2);
insert into SSObjectTypes(ObjType,TypeName,ShortName,IsDocument,PostLevel)
values('FI','Финансовое обязательство по поставке','Обязательство по поставке','0',2);
insert into SSObjectTypes(ObjType,TypeName,ShortName,IsDocument,PostLevel)
values('FO','Финансовое обязательство по отгрузке','Обязательство по отгрузке','0',2);
commit;
CREATE TABLE SSDatabases
(
DbID raw(16) not null,
DbName varchar2(255) not null,
constraint SSCDatabases_PK
primary key(DbID),
constraint SSCDatabases_Name
unique(DbName)
);
CREATE TABLE SSSysInfo
(
ParamName varchar2(50) not null,
ParamValue varchar2(255) not null,
constraint SSSysInfo_PK primary key(ParamName),
constraint SSSysInfo_Pseudo
check(ParamName not like 'Pseudo.'||'%')
);
CREATE TABLE SSSysInfoBackup
(
BackupID number(10) not null,
BackupTime date not null,
ParamName varchar2(50) not null,
ParamValue varchar2(255) not null,
constraint SSSysInfoBackup_PK primary key(BackupID,ParamName)
);
CREATE TABLE SSSysInfoEx
(
DbID raw(16) not null,
ParamName varchar2(50) not null,
ParamValue varchar2(255) not null,
constraint SSSysInfoEx_PK primary key(DbID,ParamName),
constraint SSSysInfoEx_Db
foreign key(DbID)
references SSDatabases(DbID)
on delete cascade
);
insert into SSSysInfo(ParamName,ParamValue) values('ConfigFlags',TO_CHAR(0));
begin
insert into SSSysInfo(ParamName,ParamValue) values('Version','Generating '||'1.029');
end;
/
insert into SSSysInfo(ParamName,ParamValue) values('Customer',0);
insert into SSSysInfo(ParamName,ParamValue) values('ExtendedCardLog','0');
insert into SSSysInfo(ParamName,ParamValue) values('ExtendedClientLog','0');
insert into SSSysInfo(ParamName,ParamValue) values('UpgradeStep','Upgrade in progress');
insert into SSSysInfo(ParamName,ParamValue) values('GrpViewMode','1');
insert into SSSysInfo(ParamName,ParamValue) values('NotEditBoxForActiveCard','1');
insert into SSSysInfo(ParamName,ParamValue) values('OnlyOneBoxForCard','1');
insert into SSSysInfo(ParamName,ParamValue) values('GenTime',to_char(sysdate,'DD.MM.YYYY HH24:MI:SS'));
insert into SSSysInfo(ParamName,ParamValue) values('StoreLocMin','1');
insert into SSSysInfo(ParamName,ParamValue) values('CompanyMin','1');
insert into SSSysInfo(ParamName,ParamValue) values('DocNumberSize','10');
insert into SSSysInfo(ParamName,ParamValue) values('CashTimeSpan',to_char(10));
insert into SSSysInfo(ParamName,ParamValue) values('CashDocGen','1');
insert into SSSysInfo(ParamName,ParamValue) values('FixPriceNoDisc','1');
insert into SSSysInfo(ParamName,ParamValue) values('AuctionNoDisc','1');
insert into SSSysInfo(ParamName,ParamValue) values('TimeSpanSaleDocs', '0');
insert into SSSysInfo(ParamName,ParamValue) values('CalcTaxes', '1');
insert into SSSysInfo(ParamName,ParamValue) values('Composition', '0');
insert into SSSysInfo(ParamName,ParamValue) values('POSLoadCardType',
to_char((power(2,0))+(power(2,1))+(power(2,5))));
insert into SSSysInfo(ParamName,ParamValue) values('PostDataTypes',
to_char(1));
insert into SSSysInfo(ParamName,ParamValue) values('PostDataTypesFull',
to_char(1
+2
+4
+8
+16
+32
+64));
insert into SSSysInfo(ParamName,ParamValue) values('OperPollRate',0);
insert into SSSysInfo(ParamName,ParamValue) values('PosDepartments',0);
insert into SSSysInfo(ParamName,ParamValue) values('ShowRequest',0);
insert into SSSysInfo(ParamName,ParamValue) values('ShowRqPrinter','*');
insert into SSSysInfo(ParamName,ParamValue) values('ComplexArticlePriceOriginAC', '0');
insert into SSSysInfo(ParamName,ParamValue) values('Licenses', '0');
begin
if not FALSE then
insert into SSSysInfo(ParamName,ParamValue) values('DBID', SYS_GUID());
end if;
end;
/
insert into SSSysInfo(ParamName,ParamValue) values('Legislation', '0');
insert into SSSysInfo(ParamName,ParamValue) values('DbInitCreateCardClass', '0');
insert into SSSysInfo ( ParamName, ParamValue ) values ( 'PurgeEqualPricesACWI', '1' );
insert into SSSysInfo ( ParamName, ParamValue ) values ( 'PurgeEqualPricesACIW', '1' );
insert into SSSysInfo ( ParamName, ParamValue ) values ( 'SetCashPrice', '0');
insert into SSSysInfo ( ParamName, ParamValue ) values ( 'RepriceCopyCountry', 'NOCOUNTRY' );
insert into SSSysInfo ( ParamName, ParamValue ) values ( 'PCR_GenActsDuplicateArticlesTreatment', '4' );
insert into SSSysInfo ( ParamName, ParamValue ) values ('FifoDefAlg', 0);
insert into SSSysInfo ( ParamName, ParamValue ) values ('FifoAnyLocIncome', '1');
insert into SSSysInfo ( ParamName, ParamValue ) values
('FifoCauseForOperations', to_char(2)||','||
to_char(7)||','||
to_char(8)||','||
to_char(17)||','||
to_char(3)||','||
to_char(4));
insert into SSSysInfo ( ParamName, ParamValue ) values
('FeaturesMaxValueLength', 10);
insert into SSSysInfo ( ParamName, ParamValue ) values
('ClientIDZone', -1);
insert into SSSysInfo ( ParamName, ParamValue ) values
('ClientIDZonesEx', 0);
insert into SSSysInfo ( ParamName, ParamValue ) values
('LocalUTCOffset', '0');
insert into SSSysInfo ( ParamName, ParamValue ) values
('SummerTime', '0');
insert into SSSysInfo(ParamName, ParamValue) values('CheckPostVer', '0');
commit;
CREATE TABLE SSMigratorArc
(
ArcCode varchar2(30) not null primary key,
ImportedComps number(38) default(0) not null
);
CREATE TABLE SSMigratorLog
(
ArcCode varchar2(30) not null,
CompID number(38) not null,
Amount number(38) not null,
primary key(ArcCode,CompID)
);
create global temporary table TTObjList
(
ObjType char(2) not null,
ID varchar2(150) not null,
constraint TTCObjList_PK
primary key (ObjType,ID)
) on commit preserve rows;
create global temporary table TTFailedLock
(
ObjType char(2) not null,
ID varchar2(150) not null,
ErrCode number(10) not null,
Message varchar2(4000) null
) on commit preserve rows;
CREATE SEQUENCE SSEventLogSeq MAXVALUE 1000000000 CYCLE ORDER;
CREATE TABLE SSEventLog
(
EventTime date not null,
RecID number default 0 not null,
MsgLine number(38) default(1) not null,
EventSession number not null,
EventMessage varchar2(1000) not null,
EventLogin varchar2(30) null,
EventSource varchar2(255) null,
Employee number(10) default -2 not null,
WSName varchar2(100) null,
UserName varchar2(30) null ,
OsUser varchar2(30) null,
constraint SSCEventLog_PK
primary key (EventTime, RecID, MsgLine)
);
CREATE TABLE SAHolidaysCategory
(
ID number(5) not null,
Name varchar2(255) not null,
Preset char(1) default '0' not null,
Periodicity number(5) not null,
constraint SACHolidaysCategory_PK primary key (ID),
constraint SACHolidaysCategory_Name unique (Name),
constraint SACHolidaysCategory_NegID check(ID>=0)
);
Insert into SAHolidaysCategory(ID, Name, Preset, Periodicity)
values(0, 'праздничные дни', '1', 0);
Insert into SAHolidaysCategory(ID, Name, Preset, Periodicity)
values(1, 'дополнительные выходные дни', '1', 1);
Insert into SAHolidaysCategory(ID, Name, Preset, Periodicity)
values(2, 'дополнительные рабочие дни', '1', 1);
CREATE TABLE SAHolidays
(
DayType number(5) not null,
TheDay date not null,
constraint SACHolidays_PK
primary key (DayType, TheDay),
constraint SACHolidays_Type
foreign key(DayType)
references SAHolidaysCategory(ID)
on delete cascade
);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('01.01.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('02.01.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('07.01.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('23.02.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('08.03.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('01.05.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('09.05.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('12.06.1904','DD.MM.YYYY'), 0);
Insert into SAHolidays(TheDay, DayType)
values(To_Date('04.11.1904','DD.MM.YYYY'), 0);
create global temporary table TTHolyNames
(
TheDay date not null,
TheTitle varchar2(255) not null
) on commit delete rows;
CREATE TABLE SSAppServerUsers
(
AppServer varchar2(100) not null,
SessionID varchar2(40) not null,
SessionType number(5) default(0) not null,
Employee number(10) not null,
WSName varchar2(100) null,
UserName varchar2(30) null,
OsUser varchar2(30) null,
Program varchar2(48) null,
TimePoint DATE default(sysdate) not null,
constraint SSAppServerUsers_PK
primary key (AppServer,SessionID),
constraint SSAppServerUsers_ST
check (SessionType in ( 0,
2,
3,
5,
6,
8,
9))
);
CREATE TABLE SSAppServerSessions
(
AUDSID number not null,
AppServer varchar2(100) not null,
SessionID varchar2(40) null,
constraint SSAppServerSessions_PK
primary key (AUDSID),
constraint SSAppServerSessions_Ses
foreign key(AppServer,SessionID)
references SSAppServerUsers(AppServer,SessionID)
);
COMMIT;
exit