Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Procedure for a report Post Reply Post New Topic
Author Message
signil
Newbie
Newbie
Avatar

Joined: 18 Nov 2009
Online Status: Offline
Posts: 4
Quote signil Replybullet Topic: Procedure for a report
    Posted: 26 Nov 2009 at 2:46am

Dear All,

I am trying to use the following procedure as a datasource for my crystal report. The query works as I expected but the problem is I can't figure out how to fetch back the data from those dummy tables - IFS_PR_DUMMY_TAB and IFS_PR_DUMMY2_TAB


CREATE OR REPLACE procedure dummy9_IFS_FR2_Sales (cdate IN date)

as

acontract customer_order.contract%type;
ashowroom customer_order.district_code%type;
aorderno customer_order.order_no%type;
amount number(10);

bcontract customer_order.contract%type;
bshowroom customer_order.district_code%type;
borderno customer_order.order_no%type;
bamount number(10);

CURSOR c2 IS
select  contract, district_code ,count(order_no),
SUM(CUSTOMER_ORDER_API.Get_Total_Sale_Price__(order_no))
from CUSTOMER_ORDER
where order_no IN (select distinct order_no from customer_order_line where state IN ('Released') )  AND state IN ('Released') and to_char(date_entered,'MM/DD/YYYY')>=to_char(cdate,'MM/DD/YYYY')
and contract IN
('CERA','SAN','WOD','QEM','PIP','COT','KIT','MAR','PROJ')
group by contract,district_code, date_entered ; 


CURSOR c2 IS
select  contract, district_code ,count(order_no),
SUM(CUSTOMER_ORDER_API.Get_Total_Sale_Price__(order_no))
from CUSTOMER_ORDER
where order_no IN (select distinct order_no from customer_order_line where state IN ('Reserved') )  AND state IN ('Reserved') and to_char(date_entered,'MM/DD/YYYY')>=to_char(cdate,'MM/DD/YYYY')
and contract IN
('CERA','SAN','WOD','QEM','PIP','COT','KIT','MAR','PROJ')
group by contract,district_code, date_entered ; 

begin

--For Released Orders

  OPEN c1;

  DELETE FROM IFS_PR_DUMMY_TAB;

  loop
      fetch c1 into acontract, ashowroom, aorderno, amount;
      exit when c1%notfound;
     
Insert into IFS_PR_DUMMY_TAB
(DCONTRACT ,DSHOWROOM ,DORDERNO,DAMOUNT) values (acontract,ashowroom,aorderno,amount);

end loop;
close c1;
 
--For Reserved Orders
 
 OPEN c2;

 DELETE FROM IFS_PR_DUMMY2_TAB;
 
loop
     
      fetch c2 into bcontract, bshowroom, borderno, bamount;
      exit when c2%notfound;
     
Insert into IFS_PR_DUMMY2_TAB
(ECONTRACT ,ESHOWROOM ,EORDERNO,EAMOUNT) values (bcontract,bshowroom,borderno,bamount);
 
end loop;
close c2; 

end;


Please advise.

Regards,
User


Edited by signil - 26 Nov 2009 at 2:48am
IP IP Logged
Brian
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Location: United States
Online Status: Offline
Posts: 6
Quote Brian Replybullet Posted: 01 Apr 2010 at 10:00am
This response is a long time after you posted your question, but just in case anyone else needs an answer:
 
We have reports that call stored procedures. The cursors need to be out parameters in your argument list. I don't know if 'out' suffices, in our case the developer used 'in out'. Your altered procedure call would look something like:
 
CREATE OR REPLACE procedure dummy9_IFS_FR2_Sales (cdate IN date, cs1 in out yourdefinedcursortype)
To define yourdefinedcursortype you will need to create a package header and create a ref_cursor type.
 
One example would be:

CREATE OR REPLACE PACKAGE abc.mytypes

IS

TYPE yourdefinedcursortype IS REF CURSOR RETURN abc.thetableimfetchingfrom%ROWTYPE;

TYPE anothertype2 IS RECORD(

a VARCHAR2 (10)

, b INTEGER

, c DATE

);

END mytypes;

 
-Brian
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.033 seconds.