我正在编写一个带有流水线函数的 Oracle 包来获取多条记录,查询是关于多个连接表的,它将保存到另一个表中,我为类型记录创建了一个TYPE RECORD和TABLE TYPE,然后我创建了流水线函数与他们的查询,但是当我编译包时,我得到一个错误"表达式是错误的类型"。
下面是定义包:
CREATE OR REPLACE PACKAGE MYPACKAGE_PKG AS
TYPE GLD_R IS RECORD (
ID NUMBER,
PRCCVE NUMBER(7,0),
LOTCVE NUMBER(7,0),
EPCSEQ NUMBER(18,0),
EPCBNK CHAR(3)
);
TYPE GLD_T IS TABLE OF GLD_R;
FUNCTION MY_FUNCTION(_NUM NUMBER) RETURN GLD_T PIPELINED;
END;
下面是正文包:
CREATE OR REPLACE PACKAGE BODY MYPACKAGE_PKG AS
FUNCTION MY_FUNCTION(_NUM NUMBER) RETURN GLD_T PIPELINED
AS
CURSOR T_CUR IS
SELECT
T1.ID,
T2.COLUMN01,
T2.COLUMN02,
T3.COLUMN01,
T3.COLUMN02
FROM
TABLE01 T1
INNER JOIN TABLE02 T2 ON
T1.COLUMN03 = T2.ID
INNER JOIN TABLE03 T3 ON
T1.COLUMN04 = T2.ID
WHERE
T1.COLUMN01 = _NUM
BEGIN
FOR REC IN T_CUR LOOP
PIPE ROW (REC);
END LOOP;
END MY_FUNCTION;
END;
你能说我,我做错了什么吗?