Hi All, Thanks a lot for all the replies. I have tried to include the piece of SQL code by inserting into my code. But this too is not giving any results. I am using the correct Userid/pwd/schema etc. for this. Please find the piece of code I have written.

use strict; use Tk; use Tk::BrowseEntry; use Tk::LabFrame; use Tk::JPEG; use DBI; use DBD::Oracle; use Spreadsheet::WriteExcel; . . . . . . . sub generateDailyReport{ #Create Excel my $workbook = Spreadsheet::WriteExcel->new('Report.xls'); my $worksheet = $workbook->add_worksheet(); my $from_date = @_[0]; my $to_date = @_[1]; #Connect to DB my $dbh = DBI->connect("dbi:Oracle:cecdev9","asdm_dev","c1sc0pass" +) or die "cannot connect $DBI::errstr\n"; my $sth = $dbh->prepare("SELECT gamm.PROCESS_NAME, GAMM.APPLI +CATION_NAME, TO_CHAR (TRUNC (gmz.testtime - 7 / 24, 'DD'),'MM/DD/YYYY +') Fiscal_Day,ROUND (AVG(DECODE (total_response_time, 0, NULL, total_ +response_time) / DECODE (total_page_count,0, 1,total_page_count))/ 10 +00,2) Average_Response_time FROM portal_gomez_bb_load gmz, GOMEZ_AP +P_MAPPING_MASTER gamm WHERE gmz.monitor_id = 3805260 AND (gamm.PROC +ESS_NAME = 'SAM_Exact_Product_Search' OR gamm.APPLICATION_NAME = 'SAM +_Exact_Product_Search') AND trunc(gmz.testtime) BETWEEN to_date('09/1 +2/2011','MM/DD/YYYY') AND to_date('09/15/2011','MM/DD/YYYY') AND succ +ess_flag = 0 GROUP BY gamm.PROCESS_NAME,GAMM.APPLICATION_NAME,TO_CH +AR (TRUNC (gmz.testtime - 7 / 24, 'DD'),'MM/DD/YYYY')"); #execute the query $sth->execute(); my $i = "A1"; my $j = 1; while ( my @row = $sth->fetchrow_array( ) ) { print "@row\n"; $worksheet->write($i, \@row); $j=$j+1; $i="A$j"; open(FILE,'Report.xls'); } }
Please help. Thanks, Vidya Surendran

In reply to Re^2: SQL in perl/tk by vsurend
in thread SQL in perl/tk by vsurend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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, details, 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, summary, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.