Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
id beg_date end_date info
--+--------+--------+----
1 20060101 99991231 abcd
now I insert the changed info for id 1
id beg_date end_date info
--+--------+--------+----
1 20070101 99991231 xyz
1 20060101 99991231 abcd
Then I want to enddate the previous entry with the beg_date of the new entry
id beg_date end_date info
--+--------+--------+----
1 20070101 99991231 xyz
1 20060101 20070101 abcd
my $oldComponentColumnValue='';
my $componentColumnValue='99991231';
if (tPerlFlex_1 ne '') {
$oldComponentColumnValue = $componentColumnValue;
$componentColumnValue = $tPerlFlex_1;
}
# start part of your Perl code
my $maxBegDate = 99991231;
my $oldBegDate = null;
my $currentBegDate = $maxBegDate;
my $oldId = null;
my $currentId = 0;
# here is the main part of the component,
# a piece of code executed in the row
# loop
$oldId = $currentId;
$currentId = $tPerlFlex_1;
$oldBegDate = $oldId != $currentId ? $maxBegDate : $currentBegDate;
$currentBegDate = $tPerlFlex_1;