views:

121

answers:

1

Recently I updated a Crystal Report that was doing all of its work on the client-side (Selects, formulas, etc) and changed all of the logic to be done on the server-side through Stored Procedures using an Oracle 11g database. Now the report is only being used to display the output of the stored procedures and nothing else. Everything I have read on this subject says that utilizing stored procedures should greatly reduce the running time of the report, but it still takes roughly the same amount of time to retrieve the data from the server. Is there something wrong with the stored procedure I have written, or is the issue in the Crystal Report itself? Here is the stored procedure code along with the package that defines the necessary REF CURSOR.

CREATE OR REPLACE
PROCEDURE         SP90_INVENTORYDATA_ALL 
(
  invdata_cur IN OUT sftnecm.inv_data_all_pkg.inv_data_all_type,
  dCurrentEndDate IN vw_METADATA.CASEENTRCVDDATE%type,
  dCurrentStartDate IN vw_METADATA.CASEENTRCVDDATE%type
)
AS
BEGIN
  OPEN invdata_cur FOR
     SELECT 
      vw_METADATA.CREATIONTIME, 
      vw_METADATA.RESRESOLUTIONDATE, 
      vw_METADATA.CASEENTRCVDDATE, 
      vw_METADATA.CASESTATUS, 
      vw_METADATA.CASENUMBER,
      (CASE WHEN vw_METADATA.CASEENTRCVDDATE < dCurrentStartDate AND (
        (vw_METADATA.CASESTATUS is null OR vw_METADATA.CASESTATUS != 'Closed') OR
        TO_DATE(vw_METADATA.RESRESOLUTIONDATE, 'MM/DD/YYYY') >= dCurrentStartDate) then 1 else 0 end) InventoryBegin,
      (CASE WHEN (to_date(vw_METADATA.RESRESOLUTIONDATE, 'MM/DD/YYYY') BETWEEN dCurrentStartDate AND dCurrentEndDate) 
        AND vw_METADATA.RESRESOLUTIONDATE is not null AND vw_METADATA.CASESTATUS is not null then 1 else 0 end) CaseClosed,
      (CASE WHEN vw_METADATA.CASEENTRCVDDATE BETWEEN dCurrentStartDate AND dCurrentEndDate then 1 else 0 end) CaseCreated   
 FROM   vw_METADATA 
 WHERE  vw_METADATA.CASEENTRCVDDATE <= dCurrentEndDate
 ORDER BY vw_METADATA.CREATIONTIME, vw_METADATA.CASESTATUS;
END SP90_INVENTORYDATA_ALL;

And the package:

CREATE OR REPLACE PACKAGE inv_data_all_pkg
AS TYPE inv_data_all_type IS REF CURSOR
RETURN inv_data_all_temp%ROWTYPE;
END inv_data_all_pkg;
A: 

If there is no latency between the DB server and Crystal server than no, changing where the data processing happens won't have any effect. Especially if there is not a large amount of data being moved over the network. Or in other words with 2 equally fast servers separated by a highly performant network interface there'll be little difference unless moving the data processing to the DB server significantly decreases the volume of data over the network.

Consider tuning the query (including as noted by another respondent) the defination of VW_METADATA.

Karl
I didn't design the view but I just looked at the ddl and it's a mess. I beleive tuning it will solve the problem.
mjh41