First I initialize the property "DefaultExpression" for my fields in the oracledataset methode "InternalInitFieldDefs"
procedure TX1OracleDataSet.InternalInitFieldDefs;
var
i : integer;
begin
Inherited;
InitDefaultExpression;
end;
secondly i call this procedure :
procedure DuplicateAffaire(aIdAffaire : integer);
var
oraqry : TOracleQuery;
begin
oraqry := TOracleQuery.Create(self);
try
oraqry.session := oradstAffaire.Session;
oraqry.DeclareVariable('ID_AFFAIRE', otInteger);
oraqry.SetVariable('ID_AFFAIRE', aIdAffaire);
oraqry.SQL.Add('SELECT * FROM AFFAIRE WHERE ID_AFFAIRE = :ID_AFFAIRE');
oraqry.Execute;
oradstAffaire.Insert;
for i := 0 to oraqry.FieldCount-1 do
begin
if (Query.FieldName(i)'ID_AFFAIRE') then
begin
if oradstAffaire.FindField(oraqry.FieldName(i)) nil then
oradstAffaire.FieldByName(oraqry.FieldName(i)).asVariant := oraqry.Field(i);
end;
end;
oradstAffaire.Post;
finally
oraqry.Free;
end;
end;
The problem :
For example, the field 2 as a default expression like 'A default expression'
if the field 2 of record of oradstAffaire i want to duplicate is null (and only if is null) I obtain the error message :
ORA-00984 : Un nom de colonne n'est pas autoris
procedure TX1OracleDataSet.InternalInitFieldDefs;
var
i : integer;
begin
Inherited;
InitDefaultExpression;
end;
secondly i call this procedure :
procedure DuplicateAffaire(aIdAffaire : integer);
var
oraqry : TOracleQuery;
begin
oraqry := TOracleQuery.Create(self);
try
oraqry.session := oradstAffaire.Session;
oraqry.DeclareVariable('ID_AFFAIRE', otInteger);
oraqry.SetVariable('ID_AFFAIRE', aIdAffaire);
oraqry.SQL.Add('SELECT * FROM AFFAIRE WHERE ID_AFFAIRE = :ID_AFFAIRE');
oraqry.Execute;
oradstAffaire.Insert;
for i := 0 to oraqry.FieldCount-1 do
begin
if (Query.FieldName(i)'ID_AFFAIRE') then
begin
if oradstAffaire.FindField(oraqry.FieldName(i)) nil then
oradstAffaire.FieldByName(oraqry.FieldName(i)).asVariant := oraqry.Field(i);
end;
end;
oradstAffaire.Post;
finally
oraqry.Free;
end;
end;
The problem :
For example, the field 2 as a default expression like 'A default expression'
if the field 2 of record of oradstAffaire i want to duplicate is null (and only if is null) I obtain the error message :
ORA-00984 : Un nom de colonne n'est pas autoris