2009-09-01 74 views
1

表型我有一個表聲明:光標在甲骨文

TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20)); 
TYPE PERSON_TYPE_TABLE AS TABLE OF PERSON_TYPE; 

我可以聲明光標,這將是與甲骨文我的表類型的工作?

回答

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; 
+0

很好的例子,謝謝。 – 2009-09-02 06:27:08