Bonjour tous le monde, j'ai une deux (02) requêtes que j'ai créer ou je voudrais savoir si est il possible de faire mieux en optimisation de temps à savoir que le temps d’exécution entre PlSql et sous Delphi sans différent PlSql plus rapide en exécution que Delphi.
SGBD utiliser :
Oracle8 Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.0.0 - Production
CORE Version 4.0.5.0.0 - Production
TNS for 32-bit Windows: Version 8.0.5.0.0 - Production
NLSRTL Version 3.3.2.0.0 - Production
- Oracle Client 8 et 9i.
- Delphi XE2.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
SELECT SubStr(t.Periode,5,' +
    '2)||SubStr(t.periode,1,4) Periode, t.nature, t.Periode Period, Sum(' +
    't.Debit) - Sum(t.Credit) Debit FROM Linc.Secu_Ecr t WHERE t.NumeroCot ='+
    QuotedStr(Copy(Employeur.Text,1,8))+ ' And t.periode=' + QuotedStr(Copy(
       ListBox1.Items[ListBox1.ItemIndex],3, 4) + Copy( ListBox1.Items[
       ListBox1.ItemIndex], 1, 2)) + ' Having Sum(t.Debit) - Sum(t.Credit) <> 0 Group By t.Periode, t.Nature
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Select t.Periode, t.Nature, Decode(SubStr(t.Periode, 5, 2),'+
  '''T1'', Trunc((Sum(t.Debit)-Sum(t.Credit)) * (MONTHS_BETWEEN(To_Date(SubStr('+Jour_Chois+', 1, 6), ''YYYYMM''), To_Date(SubStr(t.Periode,1,4)||''01'',''YYYYMM''))+1)/100, 2),'+
  '''T2'', Trunc((Sum(t.Debit)-Sum(t.Credit)) * (MONTHS_BETWEEN(To_Date(SubStr('+Jour_Chois+', 1, 6), ''YYYYMM''), To_Date(SubStr(t.Periode,1,4)||''03'',''YYYYMM'')))/100, 2),'+
  '''T3'', Trunc((Sum(t.Debit)-Sum(t.Credit)) * (MONTHS_BETWEEN(To_Date(SubStr('+Jour_Chois+', 1, 6), ''YYYYMM''), To_Date(SubStr(t.Periode,1,4)||''09'',''YYYYMM''))+3)/100, 2),'+
  '''T4'', Trunc((Sum(t.Debit)-Sum(t.Credit)) * (MONTHS_BETWEEN(To_Date(SubStr('+Jour_Chois+', 1, 6), ''YYYYMM''), To_Date(SubStr(t.Periode,1,4)||''09'',''YYYYMM'')))/100, 2),'+
          'Trunc((Sum(t.Debit)-Sum(t.Credit)) * (MONTHS_BETWEEN(To_Date(SubStr('+Jour_Chois+', 1, 6), ''YYYYMM''), to_date(t.Periode, ''YYYYMM'')) + 3)/100, 2)) "Montant M.R" '+
  'From Linc.Secu_Ecr t Where t.NumeroCot = '+ QuotedStr(Copy(Employeur.Text,1, 8))+
  'And t.Nature IN (''R22'', ''R07'', ''R06'', ''C22'', ''R38'', ''C38'', ''R98'', ''C98'') ' +
  'And t.Periode ='+QuotedStr(DataModule_Ecr.AdoQuery_Ecriture.FieldByName('Period').Value) +
  'Group By t.Periode, t.Nature  Order By t.Periode, t.Nature