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++;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|