Hi All,
I have a requirement of building reports using Oracle functions in PowerPivot.
My Oracle functions are like below:
CREATE OR REPLACE TYPE <DATABASENAME>.obj_Inactive_Cases
AS OBJECT
(
STATUS VARCHAR2(30),
SUB_STATUS VARCHAR2(30),
CNT NUMBER(12)
)
/
CREATE OR REPLACE TYPE <DATABASENAME>.tbl_Inactive_Cases
AS TABLE OF obj_Inactive_Cases
/
/* ----------------------------------------
Object and Type for Report -
FUNCTION getInactiveCases(
RegisteredDateFrom VARCHAR2,
RegisteredDateTo VARCHAR2)
RETURN tbl_Inactive_Cases
---------------------------------------- */
FUNCTION getInactiveCases(
RegisteredDateFrom VARCHAR2,
RegisteredDateTo VARCHAR2)
RETURN tbl_Inactive_Cases
IS
INACTIVE_CASES_TBL tbl_Inactive_Cases := tbl_Inactive_Cases();
CURSOR INACTIVE_CASES_CUR IS
SELECT TBL1.STATUS
,TBL1.SUB_STATUS
,COUNT(*) CNT
FROM (
SELECT TBL.RECORD_ID, MAX(WCS.ID) ID
FROM <DATABASENAME>.TABLE_STATUS TBL
WHERE TRUNC(TBL.START_DT) >= TO_DATE(RegisteredDateFrom,'dd/MM/yyyy')
AND TRUNC(TBL.START_DT) <= TO_DATE(RegisteredDateTo,'dd/MM/yyyy')
GROUP BY TBL.RECORD_ID
) QueryResult
LEFT JOIN <DATABASENAME>.TABLE_STATUS TBL1 ON (QueryResult.ID = TBL1.ID)
GROUP BY TBL1.STATUS, TBL1.SUB_STATUS;
BEGIN
FOR INACTIVE_CASES_REC IN INACTIVE_CASES_CUR
LOOP
INACTIVE_CASES_TBL.EXTEND;
INACTIVE_CASES_TBL(INACTIVE_CASES_TBL.LAST) := obj_Inactive_Cases(INACTIVE_CASES_REC.STATUS, INACTIVE_CASES_REC.SUB_STATUS, INACTIVE_CASES_REC.CNT);
END LOOP;
RETURN INACTIVE_CASES_TBL;
-- End function
END getInactiveCases;
I have tried using Table Import Wizard and Command Type=StoredProcedure in th ePowerPivot.
Any help will be appreciated.
Thanks and Regards,
SS
I have a requirement of building reports using Oracle functions in PowerPivot.
My Oracle functions are like below:
CREATE OR REPLACE TYPE <DATABASENAME>.obj_Inactive_Cases
AS OBJECT
(
STATUS VARCHAR2(30),
SUB_STATUS VARCHAR2(30),
CNT NUMBER(12)
)
/
CREATE OR REPLACE TYPE <DATABASENAME>.tbl_Inactive_Cases
AS TABLE OF obj_Inactive_Cases
/
/* ----------------------------------------
Object and Type for Report -
FUNCTION getInactiveCases(
RegisteredDateFrom VARCHAR2,
RegisteredDateTo VARCHAR2)
RETURN tbl_Inactive_Cases
---------------------------------------- */
FUNCTION getInactiveCases(
RegisteredDateFrom VARCHAR2,
RegisteredDateTo VARCHAR2)
RETURN tbl_Inactive_Cases
IS
INACTIVE_CASES_TBL tbl_Inactive_Cases := tbl_Inactive_Cases();
CURSOR INACTIVE_CASES_CUR IS
SELECT TBL1.STATUS
,TBL1.SUB_STATUS
,COUNT(*) CNT
FROM (
SELECT TBL.RECORD_ID, MAX(WCS.ID) ID
FROM <DATABASENAME>.TABLE_STATUS TBL
WHERE TRUNC(TBL.START_DT) >= TO_DATE(RegisteredDateFrom,'dd/MM/yyyy')
AND TRUNC(TBL.START_DT) <= TO_DATE(RegisteredDateTo,'dd/MM/yyyy')
GROUP BY TBL.RECORD_ID
) QueryResult
LEFT JOIN <DATABASENAME>.TABLE_STATUS TBL1 ON (QueryResult.ID = TBL1.ID)
GROUP BY TBL1.STATUS, TBL1.SUB_STATUS;
BEGIN
FOR INACTIVE_CASES_REC IN INACTIVE_CASES_CUR
LOOP
INACTIVE_CASES_TBL.EXTEND;
INACTIVE_CASES_TBL(INACTIVE_CASES_TBL.LAST) := obj_Inactive_Cases(INACTIVE_CASES_REC.STATUS, INACTIVE_CASES_REC.SUB_STATUS, INACTIVE_CASES_REC.CNT);
END LOOP;
RETURN INACTIVE_CASES_TBL;
-- End function
END getInactiveCases;
I have tried using Table Import Wizard and Command Type=StoredProcedure in th ePowerPivot.
Any help will be appreciated.
Thanks and Regards,
SS