CrystalVis
Technical User
Can you please tell me if the following scenario can be done in SQL Server 2000. Your help is greatly appreciated.
This is done in Oracle. I create a package called REPORT_PKG. Within the package, I declare an object called REPORT_TYP as a ref cursor. Please see code below:
CREATE OR REPLACE package REPORT_PKG
as
type REPORT_TYP is ref cursor;
end REPORT_PKG ;
/
Then I create a stored procedure that references the package REPORT_PKG. Please see below
CREATE OR REPLACE procedure OPEN_ORDER_PROC
(
OPEN_ORDER_CUR in out REPORT_PKG.REPORT_TYP
)
as
begin
open OPEN_ORDER_CUR for
SELECT
NVL(pay.type,' ') as Type,
NVL(pay.amount,0) as Amount,
NVL(ordD.status,' ') as Status,
NVL(pay.paynumber,0) as PayNumber
FROM
contact con,
order ord,
orderdetail ordD,
payment pay
WHERE
con.row_id = ord.contact_id
AND ord.row_id = ordD.order_id
AND ordD.row_id = pay.par_row_id
AND con.customer_contact = 'Y'
AND pay.reason = 'Multi'
AND pay.approval IN('Declined','Final Decline','Waiting')
;
end OPEN_ORDER_PROC;
/
This is done in Oracle. I create a package called REPORT_PKG. Within the package, I declare an object called REPORT_TYP as a ref cursor. Please see code below:
CREATE OR REPLACE package REPORT_PKG
as
type REPORT_TYP is ref cursor;
end REPORT_PKG ;
/
Then I create a stored procedure that references the package REPORT_PKG. Please see below
CREATE OR REPLACE procedure OPEN_ORDER_PROC
(
OPEN_ORDER_CUR in out REPORT_PKG.REPORT_TYP
)
as
begin
open OPEN_ORDER_CUR for
SELECT
NVL(pay.type,' ') as Type,
NVL(pay.amount,0) as Amount,
NVL(ordD.status,' ') as Status,
NVL(pay.paynumber,0) as PayNumber
FROM
contact con,
order ord,
orderdetail ordD,
payment pay
WHERE
con.row_id = ord.contact_id
AND ord.row_id = ordD.order_id
AND ordD.row_id = pay.par_row_id
AND con.customer_contact = 'Y'
AND pay.reason = 'Multi'
AND pay.approval IN('Declined','Final Decline','Waiting')
;
end OPEN_ORDER_PROC;
/