I am very sorry guys, but I can't show the exact code as it's confidential, but it goes like this.
# use DBI oracle
my $dbh = DBI->connect("dbi:Oracle:host=server.domain.com; sid=sid; po
+rt=1521", "username", "password") or die "Can't connect to database $
+DBI::errstr\n";
# The SELECT query
# This query return ~9,450,000,000 records
$sql_chr = qq{select column_a, g.column_b, column_c, column_d, column_
+e from table_f f, table_g g where f.column_a = g.column_b and column
+_c !='-/-' and column_d= 'STR' and column_e='STR1' and column_a = 9};
my $sth_chr = $dbh->prepare( $sql_chr );
if($sth_chr->execute) {
my $s=1;
while (my (@dat) = $sth_chr->fetchrow) {
##if ($dat[2]) {$tmarker=translate($dat[2]);}
## else { $tmarker="00000"; }
$tmarker=translate($dat[2]);
#$data{$dat[0]}{$dat[1]} = $dat[2];
$data{$dat[0]}{$dat[1]} = $tmarker;
$lines{$dat[0]} = "";
$markers{$dat[1]} = "";
$tmarkers{$tmarker}="";
#if (!defined $dat_chr1[1]) { $dat_chr1[1]=0; }
if (!defined $dat[3]) { $dat[3]=0;}
if (!defined $dat[4]) { $dat[4]=0;}
#if ($dat[3] eq undef) { $dat[3]=0;}
#print $dat_chr1[1]." here is the missing data\n";
#$datachr{$dat[0]}{$dat[1]}{$dat[3]} = $dat[4];
$datachr{$dat[1]}{$dat[3]} = $dat[4];
$chr{$dat[3]} = "";
# print "$s--> $cropid-->$dat[0]-->$dat[1]-->$dat[2]-->$dat[3]
+-->$dat[4]-->$tmarker\n";
$s++;
}
}
#### printing the files
my $count_markers = keys %markers;
my $count_lines = keys %lines;
# my $count_chr=keys %chr;
# print the header
my $count_chr=1;
my $checkchr = printmcdchr($csvfile, $count_markers, $count_chr);
# print the content
my $i=1;
foreach my $m (sort {$a eq $b} keys %markers) {
print OUT "$m $i\n";
$i++;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|