Fix some problems with oracle script

This commit is contained in:
Carlos Ruiz 2007-10-08 19:44:59 +00:00
parent 631739feac
commit 11a0fe3d4d
1 changed files with 190 additions and 204 deletions

View File

@ -1,204 +1,190 @@
--@author - fer_luck @ centuryono --@author - fer_luck @ centuryono
--Add Detail column --Add Detail column
--The fields are already in the databse. Just needs to update them --The fields are already in the databse. Just needs to update them
BEGIN; -- BEGIN;
update ad_field set seqno = seqno + 10 where ad_tab_id = 107 and seqno > 70;
UPDATE AD_FIELD SET seqno = seqno + 10 WHERE ad_tab_id = 107 AND seqno > 70;
update ad_field
set ad_tab_id = 107, isdisplayed = 'Y', seqno = 80 UPDATE AD_FIELD
where ad_column_id = 8547; SET ad_tab_id = 107, isdisplayed = 'Y', seqno = 80
WHERE ad_column_id = 8547;
--It's not physically in the database, so here we create it
alter table ad_field add included_tab_id numeric(10); --It's not physically in the database, so here we create it
ALTER TABLE AD_FIELD ADD included_tab_id NUMERIC(10);
--Modify the views
drop view ad_field_v; --Modify the views
CREATE OR REPLACE VIEW AD_FIELD_V -- DROP VIEW ad_field_v;
(AD_WINDOW_ID, AD_TAB_ID, AD_FIELD_ID, AD_TABLE_ID, AD_COLUMN_ID,
NAME, DESCRIPTION, HELP, ISDISPLAYED, DISPLAYLOGIC, CREATE OR REPLACE VIEW AD_FIELD_V
DISPLAYLENGTH, SEQNO, SORTNO, ISSAMELINE, ISHEADING, AS
ISFIELDONLY, ISREADONLY, ISENCRYPTEDFIELD, OBSCURETYPE, COLUMNNAME, SELECT t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID,
COLUMNSQL, FIELDLENGTH, VFORMAT, DEFAULTVALUE, ISKEY, f.NAME, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength,
ISPARENT, ISMANDATORY, ISIDENTIFIER, ISTRANSLATED, AD_REFERENCE_VALUE_ID, f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly,
CALLOUT, AD_REFERENCE_ID, AD_VAL_RULE_ID, AD_PROCESS_ID, ISALWAYSUPDATEABLE, f.IsEncrypted AS IsEncryptedField, f.ObscureType,
READONLYLOGIC, MANDATORYLOGIC, ISUPDATEABLE, ISENCRYPTEDCOLUMN, ISSELECTIONCOLUMN, TABLENAME, c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent,
VALUEMIN, VALUEMAX, FIELDGROUP, VALIDATIONCODE) COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
AS c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID,
SELECT t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
f.Name, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn,
f.IsEncrypted AS IsEncryptedField, f.ObscureType, c.IsSelectionColumn,
c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent, tbl.TableName, c.ValueMin, c.ValueMax,
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, fg.NAME AS FieldGroup, vr.Code AS ValidationCode, f.included_tab_id
c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID, FROM AD_FIELD f
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID, INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable, LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
c.IsSelectionColumn, INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
tbl.TableName, c.ValueMin, c.ValueMax, INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
fg.Name AS FieldGroup, vr.Code AS ValidationCode, f.included_tab_id LEFT OUTER JOIN AD_VAL_RULE vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID)
FROM AD_Field f WHERE f.IsActive = 'Y'
INNER JOIN AD_Tab t ON (f.AD_Tab_ID = t.AD_Tab_ID) AND c.IsActive = 'Y';
LEFT OUTER JOIN AD_FieldGroup fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
LEFT OUTER JOIN AD_Column c ON (f.AD_Column_ID = c.AD_Column_ID) -- DROP VIEW ad_field_vt;
INNER JOIN AD_Table tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
INNER JOIN AD_Reference r ON (c.AD_Reference_ID = r.AD_Reference_ID) CREATE OR REPLACE VIEW AD_FIELD_VT
LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) AS
WHERE f.IsActive = 'Y' SELECT trl.AD_LANGUAGE, t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID,
AND c.IsActive = 'Y'; trl.NAME, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength,
f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly,
f.IsEncrypted AS IsEncryptedField, f.ObscureType,
drop view ad_field_vt; c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent,
CREATE OR REPLACE VIEW AD_FIELD_VT COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
(AD_LANGUAGE, AD_WINDOW_ID, AD_TAB_ID, AD_FIELD_ID, AD_TABLE_ID, c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID,
AD_COLUMN_ID, NAME, DESCRIPTION, HELP, ISDISPLAYED, c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
DISPLAYLOGIC, DISPLAYLENGTH, SEQNO, SORTNO, ISSAMELINE, c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
ISHEADING, ISFIELDONLY, ISREADONLY, ISENCRYPTEDFIELD, OBSCURETYPE, c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn,
COLUMNNAME, COLUMNSQL, FIELDLENGTH, VFORMAT, DEFAULTVALUE, tbl.TableName, c.ValueMin, c.ValueMax,
ISKEY, ISPARENT, ISMANDATORY, ISIDENTIFIER, ISTRANSLATED, fgt.NAME AS FieldGroup, vr.Code AS ValidationCode, f.included_tab_id
AD_REFERENCE_VALUE_ID, CALLOUT, AD_REFERENCE_ID, AD_VAL_RULE_ID, AD_PROCESS_ID, FROM AD_FIELD f
ISALWAYSUPDATEABLE, READONLYLOGIC, MANDATORYLOGIC, ISUPDATEABLE, ISENCRYPTEDCOLUMN, ISSELECTIONCOLUMN, INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID)
TABLENAME, VALUEMIN, VALUEMAX, FIELDGROUP, VALIDATIONCODE) INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
AS LEFT OUTER JOIN AD_FIELDGROUP_TRL fgt ON
SELECT trl.AD_Language, t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, (f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_LANGUAGE=fgt.AD_LANGUAGE)
trl.Name, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
f.IsEncrypted AS IsEncryptedField, f.ObscureType, INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent, LEFT OUTER JOIN AD_VAL_RULE vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID)
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, WHERE f.IsActive = 'Y'
c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID, AND c.IsActive = 'Y';
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable, --Add the Grid Collapse and Tabbed item navigation
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn, INSERT INTO AD_ELEMENT
tbl.TableName, c.ValueMin, c.ValueMax, (ad_element_id, ad_client_id, ad_org_id, isactive,
fgt.Name AS FieldGroup, vr.Code AS ValidationCode, f.included_tab_id created, createdby,
FROM AD_Field f updated, updatedby,
INNER JOIN AD_Field_Trl trl ON (f.AD_Field_ID = trl.AD_Field_ID) columnname, entitytype, NAME, printname
INNER JOIN AD_Tab t ON (f.AD_Tab_ID = t.AD_Tab_ID) )
LEFT OUTER JOIN AD_FieldGroup_Trl fgt ON VALUES (53002, 0, 0, 'Y',
(f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_Language=fgt.AD_Language) TO_DATE ('07/18/2007 14:23:01', 'MM/DD/YYYY HH24:MI:SS'), 100,
LEFT OUTER JOIN AD_Column c ON (f.AD_Column_ID = c.AD_Column_ID) TO_DATE ('07/18/2007 14:23:01', 'MM/DD/YYYY HH24:MI:SS'), 100,
INNER JOIN AD_Table tbl ON (c.AD_Table_ID = tbl.AD_Table_ID) 'FieldGroupType', 'D', 'Field Group Type', 'Field Group Type'
INNER JOIN AD_Reference r ON (c.AD_Reference_ID = r.AD_Reference_ID) );
LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID)
WHERE f.IsActive = 'Y' INSERT INTO AD_REFERENCE
AND c.IsActive = 'Y'; (ad_reference_id, ad_client_id, ad_org_id, isactive,
created,
--Add the Grid Collapse and Tabbed item navigation updated, createdby,
INSERT INTO AD_ELEMENT updatedby,
(ad_element_id, ad_client_id, ad_org_id, isactive, NAME, description, help,
created, createdby, validationtype, entitytype)
updated, updatedby, VALUES (53000, 0, 0, 'Y',
columnname, entitytype, NAME, printname TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'),
) TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
VALUES (53002, 0, 0, 'Y', 100, 'AD_FieldGroup', 'Field Group Type', '',
TO_DATE ('07/18/2007 14:23:01', 'MM/DD/YYYY HH24:MI:SS'), 100, 'L', 'D');
TO_DATE ('07/18/2007 14:23:01', 'MM/DD/YYYY HH24:MI:SS'), 100,
'FieldGroupType', 'D', 'Field Group Type', 'Field Group Type' INSERT INTO AD_REF_LIST
); (ad_ref_list_id, ad_client_id, ad_org_id, isactive,
created,
insert into ad_reference updated, createdby,
(ad_reference_id, ad_client_id, ad_org_id, isactive, updatedby,
created, VALUE, NAME,
updated, createdby, ad_reference_id, entitytype)
updatedby, VALUES(53000, 0, 0, 'Y',
name, description, help, TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'),
validationtype, entitytype) TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
VALUES (53000, 0, 0, 'Y', 100,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 'T', 'Tab',
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100, 53000, 'D');
100, 'AD_FieldGroup', 'Field Group Type', '',
'L', 'D'); INSERT INTO AD_REF_LIST
(ad_ref_list_id, ad_client_id, ad_org_id, isactive,
insert into ad_ref_list created,
(ad_ref_list_id, ad_client_id, ad_org_id, isactive, updated, createdby,
created, updatedby,
updated, createdby, VALUE, NAME,
updatedby, ad_reference_id, entitytype)
value, name, VALUES(53001, 0, 0, 'Y',
ad_reference_id, entitytype) TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'),
VALUES(53000, 0, 0, 'Y', TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100, 'L', 'Label',
100, 53000, 'D');
'T', 'Tab',
53000, 'D'); INSERT INTO AD_REF_LIST
insert into ad_ref_list (ad_ref_list_id, ad_client_id, ad_org_id, isactive,
(ad_ref_list_id, ad_client_id, ad_org_id, isactive, created,
created, updated, createdby,
updated, createdby, updatedby,
updatedby, VALUE, NAME,
value, name, ad_reference_id, entitytype)
ad_reference_id, entitytype) VALUES(53002, 0, 0, 'Y',
VALUES(53001, 0, 0, 'Y', TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100, 100,
100, 'C', 'Collapse',
'L', 'Label', 53000, 'D');
53000, 'D');
insert into ad_ref_list INSERT INTO AD_COLUMN
(ad_ref_list_id, ad_client_id, ad_org_id, isactive, (ad_column_id, ad_client_id, ad_org_id, isactive,
created, created,
updated, createdby, updated, createdby,
updatedby, updatedby, NAME, description,
value, name, HELP,
ad_reference_id, entitytype) VERSION, entitytype, columnname, ad_table_id, ad_reference_id,
VALUES(53002, 0, 0, 'Y', fieldlength, iskey, isparent, ismandatory, isupdateable,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), isidentifier, seqno, istranslated, isencrypted,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100, isselectioncolumn, ad_element_id, issyncdatabase,
100, isalwaysupdateable, ad_reference_value_id
'C', 'Collapse', )
53000, 'D'); VALUES (53002, 0, 0, 'Y',
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'),
INSERT INTO AD_COLUMN TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100,
(ad_column_id, ad_client_id, ad_org_id, isactive, 100, 'Field Group Type', 'Field Group',
created, 'Field Group.',
updated, createdby, 0, 'D', 'FieldGroupType', 414, 17,
updatedby, NAME, description, 10, 'N', 'N', 'N', 'Y',
HELP, 'N', NULL, 'N', 'N',
VERSION, entitytype, columnname, ad_table_id, ad_reference_id, 'N', 53002, 'Y',
fieldlength, iskey, isparent, ismandatory, isupdateable, 'N', 53000
isidentifier, seqno, istranslated, isencrypted, );
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable, ad_reference_value_id ALTER TABLE AD_FIELDGROUP ADD fieldgrouptype CHAR(1);
)
VALUES (53002, 0, 0, 'Y', INSERT INTO AD_FIELD
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), (ad_field_id, ad_client_id, ad_org_id, isactive,
TO_DATE ('07/18/2007 14:22:51', 'MM/DD/YYYY HH24:MI:SS'), 100, created, createdby,
100, 'Field Group Type', 'Field Group', updated, updatedby,
'Field Group.', NAME, description,
0, 'D', 'FieldGroupType', 414, 17, HELP,
10, 'N', 'N', 'N', 'Y', iscentrallymaintained, ad_tab_id, ad_column_id, isdisplayed,
'N', null, 'N', 'N', displaylength, isreadonly, seqno, sortno, issameline, isheading,
'N', 53002, 'Y', isfieldonly, isencrypted, entitytype
'N', 53000 )
); VALUES (53002, 0, 0, 'Y',
TO_DATE ('07/18/2007 14:23:09', 'MM/DD/YYYY HH24:MI:SS'), 100,
ALTER TABLE ad_fieldgroup ADD fieldgrouptype char(1); TO_DATE ('07/18/2007 14:23:17', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Field Group Type', 'Field Group Type',
INSERT INTO AD_FIELD 'The Field Group type',
(ad_field_id, ad_client_id, ad_org_id, isactive, 'Y', 342, 53002, 'Y',
created, createdby, 10, 'N', 60, 0, 'N', 'N',
updated, updatedby, 'N', 'N', 'D'
NAME, description, );
HELP,
iscentrallymaintained, ad_tab_id, ad_column_id, isdisplayed, COMMIT;
displaylength, isreadonly, seqno, sortno, issameline, isheading,
isfieldonly, isencrypted, entitytype -- NOTE: Don't forget to run the three processes:
) -- 1 - Add missing translations in the language screen
VALUES (53002, 0, 0, 'Y', -- 2 - Synchronize terminology
TO_DATE ('07/18/2007 14:23:09', 'MM/DD/YYYY HH24:MI:SS'), 100, -- 3 - Check sequences
TO_DATE ('07/18/2007 14:23:17', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Field Group Type', 'Field Group Type',
'The Field Group type',
'Y', 342, 53002, 'Y',
10, 'N', 60, 0, 'N', 'N',
'N', 'N', 'D'
);
COMMIT;
-- NOTE: Don't forget to run the three processes:
-- 1 - Add missing translations in the language screen
-- 2 - Synchronize terminology
-- 3 - Check sequences