Hello,
I have a parent-child-grandchild setup using TOracleDatasets on the back end and TClientDatasets on the client end. If I have just parent and child, my updates work fine. When I add the grandchild, the update on the child table loses its primary key field in the "insert" statement and causes an ORA-01400 error.
Is there something that I'm missing that I need to set when doing this? The UpdateMode on the provider is upWhereKeyOnly. The ProviderFlags for the missing field are [pfInUpdate,pfInWhere,pfInKey].
My sample application client code looks like the following, where cdsExpenseGroups is the parent, cdsExpenses is the child and cdsExpenseDetails is the grandchild:
cdsExpenseGroups.Open;
cdsExpenses.Open;
cdsExpenseDetails.Open;
cdsExpenses.Append;
cdsExpensesEXPENSE_ID.Value := 27043;
cdsExpensesEXPENSE_GROUP_ID.Value := 13089;
cdsExpensesEXPENSE_DATE.Value := Date;
cdsExpensesENTRY_DATE.Value := Date;
cdsExpensesMODIFIED_DATE.Value := Now;
cdsExpensesCURRENCY_TYPE.Value := 108;
cdsExpensesCURRENCY_RATE.Value := 1;
cdsExpensesCOUNTRY_ID.Value := 1;
cdsExpenses.Post;
cdsExpenseDetails.Append;
cdsExpenseDetailsEXPENSE_DETAIL_ID.Value := 22648;
cdsExpenseDetailsEXPENSE_ID.Value := 27043;
cdsExpenseDetailsEXPENSE_TYPE_ID.Value := 133;
cdsExpenseDetailsAMOUNT.Value := 123.21;
cdsExpenseDetailsMODIFIED_DATE.Value := now;
cdsExpenseDetails.Post;
cdsExpenseGroups.Post;
cdsExpenseGroups.ApplyUpdates(0);
The following is from the OracleMonitor:
insert into "SIRS_EXPENSES"
("EXPENSE_GROUP_ID", "EXPENSE_DATE", "ENTRY_DATE", "MODIFIED_DATE", "CURRENCY_TYPE", "CURRENCY_RATE", "COUNTRY_ID", "STATE_ABBREVIATION", "CITY_ID", "FOREIGN_CITY")
values
V0, :V1, :V2, :V3, :V4, :V5, :V6, :V7, :V8, :V9)
Note the expense_id field is missing.
The sql on the TOracleDataset for the child dataset is
select * from sirs_expenses where expense_group_id = :expense_group_id
Thanks,
Natalie
I have a parent-child-grandchild setup using TOracleDatasets on the back end and TClientDatasets on the client end. If I have just parent and child, my updates work fine. When I add the grandchild, the update on the child table loses its primary key field in the "insert" statement and causes an ORA-01400 error.
Is there something that I'm missing that I need to set when doing this? The UpdateMode on the provider is upWhereKeyOnly. The ProviderFlags for the missing field are [pfInUpdate,pfInWhere,pfInKey].
My sample application client code looks like the following, where cdsExpenseGroups is the parent, cdsExpenses is the child and cdsExpenseDetails is the grandchild:
cdsExpenseGroups.Open;
cdsExpenses.Open;
cdsExpenseDetails.Open;
cdsExpenses.Append;
cdsExpensesEXPENSE_ID.Value := 27043;
cdsExpensesEXPENSE_GROUP_ID.Value := 13089;
cdsExpensesEXPENSE_DATE.Value := Date;
cdsExpensesENTRY_DATE.Value := Date;
cdsExpensesMODIFIED_DATE.Value := Now;
cdsExpensesCURRENCY_TYPE.Value := 108;
cdsExpensesCURRENCY_RATE.Value := 1;
cdsExpensesCOUNTRY_ID.Value := 1;
cdsExpenses.Post;
cdsExpenseDetails.Append;
cdsExpenseDetailsEXPENSE_DETAIL_ID.Value := 22648;
cdsExpenseDetailsEXPENSE_ID.Value := 27043;
cdsExpenseDetailsEXPENSE_TYPE_ID.Value := 133;
cdsExpenseDetailsAMOUNT.Value := 123.21;
cdsExpenseDetailsMODIFIED_DATE.Value := now;
cdsExpenseDetails.Post;
cdsExpenseGroups.Post;
cdsExpenseGroups.ApplyUpdates(0);
The following is from the OracleMonitor:
insert into "SIRS_EXPENSES"
("EXPENSE_GROUP_ID", "EXPENSE_DATE", "ENTRY_DATE", "MODIFIED_DATE", "CURRENCY_TYPE", "CURRENCY_RATE", "COUNTRY_ID", "STATE_ABBREVIATION", "CITY_ID", "FOREIGN_CITY")
values

Note the expense_id field is missing.
The sql on the TOracleDataset for the child dataset is
select * from sirs_expenses where expense_group_id = :expense_group_id
Thanks,
Natalie