The query should be executed by Oracle, not by the driver, hence the complexity should not matter. As marto said, turn on error reporting.

BTW, you can rewrite "AND (gamm.PROCESS_NAME = 'SAM_Exact_Product_Search' OR gamm.APPLICATION_NAME = 'SAM_Exact_Product_Search')" as "AND 'SAM_Exact_Product_Search' IN (gamm.PROCESS_NAME, gamm.APPLICATION_NAME)"

. Get's rid of the OR and only requires the literal once.

trunc(gmz.testtime) will obviate the use of any INDEX on gmz.testtime, better to use AND gmz.testtime >= to_date('09/12/2011','MM/DD/YYYY') AND gmz.testtime < to_date('09/16/2011','MM/DD/YYYY')

IIUC, i don't think you need to specify TO_CHAR in the GROUP BY clause.

For formatting the query, so people can read it, try:

SELECT
	gamm.PROCESS_NAME,
	GAMM.APPLICATION_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)
	 )
	 / 1000,
	 2
	) Average_Response_time
FROM
	portal_gomez_bb_load		gmz,
	GOMEZ_APP_MAPPING_MASTER	gamm
WHERE
	gmz.monitor_id			= 3805260
  AND	'SAM_Exact_Product_Search'	IN (gamm.PROCESS_NAME, gamm.APPLICATION_NAME)
  AND	gmz.testtime			>= to_date('09/12/2011','MM/DD/YYYY')
  AND	gmz.testtime			< to_date('09/16/2011','MM/DD/YYYY')
  AND	success_flag			= 0
GROUP BY
	gamm.PROCESS_NAME,
	GAMM.APPLICATION_NAME,
	TRUNC (gmz.testtime - 7 / 24, 'DD');

In reply to Re: SQL in perl/tk by chacham
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.