[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Two hits - one go



Can anyone help me out on this one:
   - within a select statement I placed the following dateadd;
   - the select statement is being hit twice within one run;
   - what it should do is give back a <&dt_old> value two months
                                       earlier than <#mnth_old>;
   - as the log-file reveals, the 1st time no adding took place,
                                        but the 2nd time it did;



SQR-Source:

Begin-Procedure Calculate_Date
Begin-Select
(...)                                                 |
dateadd(mm, round(#mnth_old, 0) * -1,                 |
                         &dystr.dtdb) &dt_old         |--> passes twice
 show '&dt_old: '      &dt_old                        |--> in same run
 show '#mnth_old: '    #mnth_old                      |
 show '&dystr.dtdb: '  &dystr.dtdb                    |
End-Select
End-Procedure



LOG-File:

&dystr.dtdb: Feb  1 1999 12:00:00:000AM               |
#mnth_old: 2.000000                                   |--> first pass (wrong)
$dt_old: Feb  1 1999                                  |


&dystr.dtdb: Feb  1 1999 12:00:00:000AM               |
#mnth_old: 2.000000                                   |--> second pass (okay)
$dt_old: Dec  1 1998                                  |



Does anyone have a hunch as to what variables I might be overlooking?

Thanks in advance,

Aida van de Brake,
Interleasing Nederland B.V.,
Amsterdam, Holland.
abr@interleasing.nl