这里是我的oracle表
CREATE TABLE TMASTER (
ID NUMBER(10,0) NOT NULL, -- DELPHI BCD with precision 10 sz 0
PARENT NUMBER(10,0) NOT NULL, -- DELPHI BCD with precision 10 sz 0
NAME VARCHAR2(100) NOT NULL
);
CREATE UNIQUE INDEX TMASTER_ID ON TMASTER(ID);
ALTER TABLE TMASTER ADD CONSTRAINT TMASTER_ID PRIMARY KEY(ID);
CREATE TABLE TDETAIL (
ID RAW(16) DEFAULT SYS_GUID() NOT NULL,
MASTERID NUMBER(10,0), -- DELPHI BCD with precision 10 sz 0
SORTID NUMBER(10,0), -- DELPHI BCD with precision 10 sz 0
NAME VARCHAR2(100),
QTY NUMBER(5,0), -- DELPHI BCD with precision 5 sz 0
FOREIGN KEY (MASTERID) REFERENCES TMASTER(ID)
);
CREATE UNIQUE INDEX TDETAIL_ID ON TDETAIL(ID);
ALTER TABLE TDETAIL ADD CONSTRAINT TDETAIL_ID PRIMARY KEY(ID);
当打开详细信息时表异常引发,BCDField作为主要详细信息,因为oracle类型号与标量(10,0)被检测为BCDField。 我的delphi示例,当我使用int32
将NUMBER(10,0)更改为NUMBER(8,0)< - 时,MapRules不起作用type
TDetailHelper = class(TComponent)
private
FMaster: TFDTable;
FMasterSource: TDataSource;
FDetail: TFDTable;
protected
procedure DoInternalOpen;
end;
procedure TDetailHelper.DoInternalOpen;
begin
if not FMaster.Active then
begin
FMaster.TableName := 'TMASTER';
FMaster.IndexName := 'TMASTER_ID';
end;
FDetail.TableName := 'TDETAIL';
FDetail.MasterSource := FMasterSource;
FDetail.IndexName := 'TDETAIL_ID';
FDetail.MasterFields := 'ID';
FDetail.DetailFields := 'MASTERID';
{Open ALL}
FMaster.DisableControls;
FDetail.DisableControls;
try
FMaster.Open; { <-- Open OK}
FDetail.Open; { <-- Raise Exception}
finally
FMaster.EnableControls;
FDetail.EnableControls;
end;
end;
我得到此例外&#34;为字段“ID&#39;&#34;提高无效的变体类型或大小 有人可以解释为什么这个异常会引发。