我有一个表格声明:
TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20));
TYPE PERSON_TYPE_TABLE AS TABLE OF PERSON_TYPE;
我可以在Oracle中声明可以使用我的表类型的游标吗?
答案 0 :(得分:3)
DECLARE
p PERSON_TYPE_TABLE := PERSON_TYPE_TABLE(PERSON_TYPE(1, 'test'));
id INT;
name VARCHAR2(100);
CURSOR mycur
IS
SELECT *
FROM TABLE(p);
BEGIN
OPEN mycur;
FETCH mycur
INTO id, name;
CLOSE mycur;
END;