Thursday, October 21, 2004

Oracle INSERT data

damy PK for ID and EntityCode:

create procedure ba_dealerreportinitialdata is
ecnum number; yyy number; uniqueIDVar VARCHAR2(16);
BEGIN
select identifier into ecnum from private_entity_identifier where name='SIBDealerReportType'; yyy := 1;
uniqueIDVar := 'UniqueId' yyy;
insert into DealerReportType (sibID, sibEntityCode, reportTypeName) values (uniqueIDVar, ecnum, 'CSI Results');
yyy := yyy + 1;
uniqueIDVar := 'UniqueId' yyy;
insert into DealerReportType (sibID, sibEntityCode, reportTypeName) values (uniqueIDVar, ecnum, 'KPI Reports');
yyy := yyy + 1;
uniqueIDVar := 'UniqueId' yyy;
insert into DealerReportType (sibID, sibEntityCode, reportTypeName) values (uniqueIDVar, ecnum, 'TCR Reports');
yyy := yyy + 1;
uniqueIDVar := 'UniqueId' yyy;
insert into DealerReportType (sibID, sibEntityCode, reportTypeName) values (uniqueIDVar, ecnum, 'Benchmark Reports');
END;

begin ba_dealerreportinitialdata;
end;

drop procedure ba_dealerreportinitialdata;

WebObjects Blog

It took me age to fix this problem, so REMEMBER it.
In the EOModel, the PK in dealer table is Double number which is different from Integer Number.
So becarefully create FK, the best way is copy the PK and past to new table.