Populating number data in a sequential manner.
I am a newbie to Perl and are trying to populate some data into our database
to do some testing. What I would like to achieve it's to help populate :
(a) EMP_SEQ : Populate number at a incremental rate, ie. 1 -500000. (The
generated must be unique and cannot have duplicate numbers)
(b) EFFECTIVE_DATE : Populate EFFECTIVE_DATE at a random manner
within a realistic "Given Threshold". ie. between (1-MAY-1980
07:29:141 to 3-MARCH-2000
07:29:120) The time population is not mandatory, it would be fine if
we can populate just the
So far, I the number EMP_SEQ that I am generating seems to have many
the date generated are RANDOM at a unrealistic DATE frame.
If anyone can provide some pointers on ANY of the issue as above , it would
be very much appreciated.
Please let me know if you need more explicit information or if I am not
Thanks All in advance and you have a pleasant day.
Sample of my draft script :-
#global letters array.
'JAN', 'FEB', 'MAR', 'APR',
'MAY', 'JUN', 'JUL', 'AUG',
'SEP', 'OCT', 'NOV', 'DEC'
my $i, $j;
open ( LOAD, ">Dept_History_Data.txt" ) or die "Can't open load.txt $!\n";
for ( $i = 0; $i < 5000; ++$i )
for ( $j = 0; $j < 1000; ++$j )
printf LOAD ( "%d,", $i * 10 + $j ); #EMP_SEQ (PrimaryKey)
printf LOAD DeptSeq(1) . ","; #DEPT_SEQ NUMBER
print LOAD date_rand(1) . "\n"; #EFFECTIVE_DATE DATE
sub DeptSeq # ( nLetters )
for ( $i = 0; $i < $nLetters; ++$i )
$Str .= $DeptSeq[int(rand(10))];
$Str = sprintf( "\'%02d-%3s-%02d %02d:%02d:%02d\'",
int(rand(27)) + 1,