Batch Update Oracle Nomal Mode and CLOB

Batch Update Oracle Nomal Mode and CLOB

Hi,

I use batch update to update records in a query. My query have a CLOB field a the end like this

  1.                  //---- Sql : Update
                     UQ.Sql.Text := 'UPDATE T_MESURES_STEP SET VALEUR = :VALEUR,CODE_REM = :CODE_REM,CODE_U = :CODE_U,METHODE = :METHODE,QUALIF = :QUALIF,STATUT = :STATUT' + ',ACCREANA = :ACCREANA' + ',DHANALYSE = :DHANALYSE,INSITUANALYSE = :INSITUANALYSE,LABORATOIRE = :LABORATOIRE,LDANA = :LDANA,LQANA = :LQANA,LSANA = :LSANA,PRODUCTEUR = :PRODUCTEUR,' + 'SUPPORT = :SUPPORT,DUREEPRLVT = :DUREEPRLVT,PRELEVEUR = :PRELEVEUR,CONFORMPRLVT = :CONFORMPRLVT,ACCREPRLVT = :ACCREPRLVT,DHRECHANT' +' = :DHRECHANT,DHPRLVT = :DHPRLVT,AGREANA = :AGREANA,' + 'INCERTANA = :INCERTANA,COMANA = :COMANA WHERE (CODE_PTM = :CODE_PTM) AND (CODE_PARAM = :CODE_PARAM) AND (FINALITE = :FINALITE) AND (DATE_MESURE = :DATE_MESURE) AND (F_ANALYSEE = :F_ANALYSEE)';
                     UQ.Params[0].DataType  := ftFloat;    //---- VALEUR
                     UQ.Params[1].DataType  := ftString;   //---- CODE_REM
                     UQ.Params[2].DataType  := ftString;   //---- CODE_U
                     UQ.Params[3].DataType  := ftString;   //---- METHODE
                     UQ.Params[4].DataType  := ftString;   //---- QUALIF
                     UQ.Params[5].DataType  := ftString;   //---- STATUT
                     UQ.Params[6].DataType  := ftString;   //---- ACCREANA
                     UQ.Params[7].DataType  := ftDateTime; //---- DHANALYSE
                     UQ.Params[8].DataType  := ftString;   //---- INSITUANALYSE
                     UQ.Params[9].DataType  := ftInteger;  //---- LABORATOIRE
                     UQ.Params[10].DataType := ftFloat;    //---- LDANA
                     UQ.Params[11].DataType := ftFloat;    //---- LQANA
                     UQ.Params[12].DataType := ftFloat;    //---- LSANA
                     UQ.Params[13].DataType := ftInteger;  //---- PRODUCTEUR
                     UQ.Params[14].DataType := ftString;   //---- SUPPORT
                     UQ.Params[15].DataType := ftString;   //---- DUREEPRLVT
                     UQ.Params[16].DataType := ftInteger;  //---- PRELEVEUR
                     UQ.Params[17].DataType := ftString;   //---- CONFORMPRLVT
                     UQ.Params[18].DataType := ftString;   //---- ACCREPRLVT
                     UQ.Params[19].DataType := ftDateTime; //---- DHRECHANT
                     UQ.Params[20].DataType := ftDateTime; //---- DHPRLVT
                     UQ.Params[21].DataType := ftString;   //---- AGREANA
                     UQ.Params[22].DataType := ftString;   //---- INCERTANA
                     UQ.Params[23].DataType := ftMemo;     //---- COMANA
                     UQ.Params[24].DataType := ftInteger;  //---- CODE_PTM
                     UQ.Params[25].DataType := ftString;   //---- CODE_PARAM
                     UQ.Params[26].DataType := ftString;   //---- FINALITE
                     UQ.Params[27].DataType := ftDateTime; //---- DATE_MESURE
                     UQ.Params[28].DataType := ftString;   //---- F_ANALYSEE

                     //---- Par bloc de MAX_BATCH
                     UQ.Params.ValueCount := MAX_BATCH;
                     NbUpdate             := 0;


then

  1.                                UQ.Params[0][NbUpdate].AsFloat    := PQ.FieldByName('VALEUR').AsFloat;           //---- VALEUR
                                   UQ.Params[1][NbUpdate].AsString   := PQ.FieldByName('CODE_REM').AsString;        //---- CODE_REM
                                   UQ.Params[2][NbUpdate].AsString   := PQ.FieldByName('CODE_U').AsString;          //---- CODE_U
                                   UQ.Params[3][NbUpdate].AsString   := PQ.FieldByName('METHODE').AsString;         //---- METHODE
                                   UQ.Params[4][NbUpdate].AsString   := PQ.FieldByName('QUALIF').AsString;          //---- QUALIF
                                   UQ.Params[5][NbUpdate].AsString   := PQ.FieldByName('STATUT').AsString;          //---- STATUT
                                   UQ.Params[6][NbUpdate].AsString   := PQ.FieldByName('ACCREANA').AsString;        //---- ACCREANA
                                   if not PQ.FieldByName('DHANALYSE').IsNull then
                                      UQ.Params[7][NbUpdate].AsDateTime := PQ.FieldByName('DHANALYSE').AsDateTime   //---- DHANALYSE
                                   else
                                       UQ.Params[7][NbUpdate].Clear;                                                //---- DHANALYSE
                                   UQ.Params[8][NbUpdate].AsString   := PQ.FieldByName('INSITUANALYSE').AsString;   //---- INSITUANALYSE
                                   UQ.Params[9][NbUpdate].AsInteger  := LABORATOIRE;                                //---- LABORATOIRE
                                   if PQ.FieldByName('LDANA').AsInteger <> -1 then
                                      UQ.Params[10][NbUpdate].AsFloat := PQ.FieldByName('LDANA').AsFloat            //---- LDANA
                                   else
                                       UQ.Params[10][NbUpdate].Clear;                                               //---- LDANA
                                   if PQ.FieldByName('LQANA').AsInteger <> -1 then
                                      UQ.Params[11][NbUpdate].AsFloat := PQ.FieldByName('LQANA').AsFloat            //---- LQANA
                                   else
                                       UQ.Params[11][NbUpdate].Clear;                                               //---- LQANA
                                   if PQ.FieldByName('LSANA').AsInteger <> -1 then
                                      UQ.Params[12][NbUpdate].AsFloat := PQ.FieldByName('LSANA').AsFloat            //---- LSANA
                                   else
                                       UQ.Params[12][NbUpdate].Clear;                                               //---- LSANA
                                   UQ.Params[13][NbUpdate].AsInteger  := PRODUCTEUR;                                //---- PRODUCTEUR
                                   UQ.Params[14][NbUpdate].AsString   := PQ.FieldByName('SUPPORT').AsString;        //---- SUPPORT
                                   if PQ.FieldByName('DUREEPRLVT').AsString <> '' then
                                      UQ.Params[15][NbUpdate].AsString   := PQ.FieldByName('DUREEPRLVT').AsString   //---- DUREEPRLVT
                                   else
                                       UQ.Params[15][NbUpdate].Clear;                                               //---- DUREEPRLVT
                                   UQ.Params[16][NbUpdate].AsInteger  := PRELEVEUR;                                 //---- PRELEVEUR
                                   if PQ.FieldByName('CONFORMPRLVT').AsString <> '' then
                                      UQ.Params[17][NbUpdate].AsString := PQ.FieldByName('CONFORMPRLVT').AsString   //---- CONFORMPRLVT
                                   else
                                       UQ.Params[17][NbUpdate].Clear;                                               //---- CONFORMPRLVT
                                   if PQ.FieldByName('ACCREPRLVT').AsString <> '' then
                                      UQ.Params[18][NbUpdate].AsString := PQ.FieldByName('ACCREPRLVT').AsString     //---- ACCREPRLVT
                                   else
                                       UQ.Params[18][NbUpdate].Clear;                                               //---- ACCREPRLVT
                                   if not PQ.FieldByName('DHRECHANT').IsNull then
                                      UQ.Params[19][NbUpdate].AsDateTime := PQ.FieldByName('DHRECHANT').AsDateTime  //---- DHRECHANT
                                   else
                                       UQ.Params[19][NbUpdate].Clear;                                               //---- DHRECHANT
                                   UQ.Params[20][NbUpdate].AsDateTime := PQ.FieldByName('DHPRLVT').AsDateTime;      //---- DHPRLVT
                                   if PQ.FieldByName('AGREANA').AsString <> '' then
                                      UQ.Params[21][NbUpdate].AsString := PQ.FieldByName('AGREANA').AsString        //---- AGREANA
                                   else
                                      UQ.Params[21][NbUpdate].Clear;                                                //---- AGREANA
                                   if PQ.FieldByName('INCERTANA').AsString <> '' then
                                      UQ.Params[22][NbUpdate].AsString := PQ.FieldByName('INCERTANA').AsString      //---- INCERTANA
                                   else
                                       UQ.Params[22][NbUpdate].Clear;                                               //---- INCERTANA
                                   UQ.Params[23][NbUpdate].AsMemo      := PQ.FieldByName('COMANA').AsString;        //---- COMANA
                                   UQ.Params[24][NbUpdate].AsInteger   := CODE_PTM;                                 //---- CODE_PTM
                                   UQ.Params[25][NbUpdate].AsString    := PQ.FieldByName('CODE_PARAM').AsString;    //---- CODE_PARAM
                                   UQ.Params[26][NbUpdate].AsString    := PQ.FieldByName('FINALITE').AsString;      //---- FINALITE
                                   UQ.Params[27][NbUpdate].AsDateTime  := PQ.FieldByName('DATE_MESURE').AsDateTime; //---- DATE_MESURE
                                   UQ.Params[28][NbUpdate].AsString    := PQ.FieldByName('F_ANALYSEE').AsString;    //---- F_ANALYSEE


when I valid the query

  1.                  if NbUpdate > 0 then
                     begin
                          try
                             UQ.Execute(NbUpdate,0);
                          except on E: Exception do
                                    WriteLog(Format('Erreur lors du batch update %d [%s]',[NbUpdate,E.Message]));
                          end;
                     end;


I have error message : invalid LOB locator specified or ORA-24816: Données bind non LONG développées fournies après colonne LONG ou LOB, it depends of Oracle version

Error only occur if I update in Oracle Normal mode. If I use Direct Mode It work fine, if I replace Update by Insert it work fine, if I done the same query without batch update (execSql) I work fine.

Tested with : Unidac 9.2.1 and 9.3.0 and Delphi XE8
Oracle server side : 19, local client : 11 XE

I seems to dosen't work also with Oracle 12c in Direct mode.

Can you help me please.