Crystal XI
Oracle 9i
OLE DB (ADO)
I have an Stored Procedure that is the data source for my report. I would like this SP to update the table with the correct data based off the parameter input from the user. It seems that the only time I can get the correct data in the table is when I use the Database:Verify Database command in Crystal. When verifying the database, the table is populated with the correct data based off the date parameter. If I just run the report using the refresh button, this table does not update. I am not too familiar with Oracle SP's, but assume a transaction is not being completed? Any input on the SP below. I have played around using 'commit;' and 'truncate' over 'delete' and not having any luck.
Any help would be much appreciated. Thanks.
Example:
Oracle 9i
OLE DB (ADO)
I have an Stored Procedure that is the data source for my report. I would like this SP to update the table with the correct data based off the parameter input from the user. It seems that the only time I can get the correct data in the table is when I use the Database:Verify Database command in Crystal. When verifying the database, the table is populated with the correct data based off the date parameter. If I just run the report using the refresh button, this table does not update. I am not too familiar with Oracle SP's, but assume a transaction is not being completed? Any input on the SP below. I have played around using 'commit;' and 'truncate' over 'delete' and not having any luck.
Any help would be much appreciated. Thanks.
Example:
Code:
CREATE OR REPLACE PROCEDURE
sp_divcomm_act_report (v_enddate date) as
v_startmonth number;
v_startyear number;
v_endmonth number;
v_endyear number;
v_monthinx number;
v_yearinx number;
v_prof number := 1;
v_lictype number := 1003;
v_dgcitem number := 1002;
v_cgccitem number := 622;
v_firstdate date;
vv_new_apps number;
BEGIN
DELETE FROM divcomm_act_report;
select min(checklist_history.entry_date)
INTO v_firstdate
FROM checklist_history,
license
WHERE checklist_history.license_id = license.license_id and
license.profession_id = v_prof AND
license.license_type = v_lictype;
v_startmonth := EXtract(month from v_firstdate);
v_startyear := EXtract(year from v_firstdate);
v_endmonth := EXtract(month from v_enddate);
v_endyear := EXtract(year from v_enddate);
v_monthinx := v_startmonth;
v_yearinx := v_startyear;
while v_monthinx+(12*v_yearinx) <= v_endmonth+(12*v_endyear) LOOP
SELECT count(*)
into vv_new_apps
FROM checklist_history,
license
WHERE checklist_history.license_id = license.license_id and
license.profession_id = v_prof AND
license.license_type = v_lictype AND
extract(month from checklist_history.entry_date) = v_monthinx AND
extract(year from checklist_history.entry_date) = v_yearinx and
checklist_history.entry_date <= v_enddate;
SELECT vv_new_apps + count(*)
into vv_new_apps
FROM checklist,
license
WHERE checklist.license_id = license.license_id and
license.profession_id = v_prof AND
license.license_type = v_lictype AND
extract(month from checklist.entry_date) = v_monthinx AND
extract(year from checklist.entry_date) = v_yearinx and
checklist.entry_date <= v_enddate;
INSERT INTO divcomm_act_report
(rpt_month,rpt_year,new_apps)
VALUES (v_monthinx,v_yearinx,vv_new_apps);
IF v_monthinx < 12 THEN
v_monthinx := v_monthinx+1;
ELSE
v_monthinx := 1;
v_yearinx := v_yearinx + 1;
END IF;
END Loop;
END;