我正在尝试从BI Publisher调用存储过程,并且需要一些帮助才能实现此目的。
以下是我所拥有的: 在我的数据模型中,我有以下代码:
DECLARE
type refcursor is REF CURSOR;
xdo_cursor refcursor;
BEGIN
OPEN :xdo_cursor FOR
SELECT IPVOWN.F1(5) FROM DUAL;
COMMIT;
END;
SQL类型=非标准SQL 从xdo_cursor中删除“:”时,运行此代码在SQL Developer中有效,但在BI中,“:”是必需的。我在日志文件中收到以下错误:
<txt>java.sql.SQLException: ORA-06550: line 2, column 22:
PLS-00103: Encountered the symbol "." when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
提前谢谢。
答案 0 :(得分:0)
以下是有关如何从BI Publisher调用函数的步骤/文档:
CREATE OR REPLACE FUNCTION FUNC1 (P1 VARCHAR2) RETURN SYS_REFCURSOR IS
XDO_CURSOR SYS_REFCURSOR;
BEGIN
IF P1 = 'USA' THEN
OPEN XDO_CURSOR FOR
'SELECT TO_CHAR(SYSDATE,''MM-DD-YYYY'') AS CURRENT_DATE, X.STATE FROM schemaName.XX1 X WHERE X.ID IN (100,200,400)';
RETURN XDO_CURSOR;
ELSE
OPEN XDO_CURSOR FOR
'SELECT TO_CHAR(SYSDATE,''MM-DD-YYYY'') AS CURRENT_DATE, X.STATE FROM schemaName.XX1 X WHERE X.ID IN (300,500,600)';
RETURN XDO_CURSOR;
END IF ;
END FUNC1;
GRANT EXECUTE ON schemaName.FUNC1 TO BI_User;
在BI Publisher的数据集中 - 您可以执行以下操作来调用该函数:确保SQL的类型为“Procedure Call”
DECLARE
type refcursor is REF CURSOR;
xdo_cursor refcursor;
BEGIN
:xdo_cursor := SchemaName.func1(:P1);
END;
有关详情,请使用以下链接: https://community.oracle.com/thread/888365