我有这种类型的定义:
Create Type "T1" as Table of Varchar2(10);/
这已经执行了。
如何在PL / SQL中使用T1类型变量?我有以下程序:
Create or replace PROCEDURE P1
AS
P_K T1;
BEGIN
SELECT P_K_J INTO P_K FROM SOME_TABLE WHERE NAME='JONES' ;
FOR I IN P_K.FIRST..P_K.LAST LOOP
DBMS_OUTPUT.PUT_LINE('THE VALUES OF P_K ARE' || P_K(I));
END LOOP;
END P1;
这会出现以下错误:
ERROR: 3/5 PL/SQL: Item ignored 3/5 PLS-00311: the declaration of "T1" is incomplete or malformed
我的问题是:如何实例化T1
答案 0 :(得分:1)
Create Type "T1" as Table of Varchar2(10);
/
Create or replace PROCEDURE P1
AS
P_K T1;
BEGIN
SELECT P_K_J BULK COLLECT INTO P_K FROM SOME_TABLE WHERE NAME='JONES';
FOR I IN P_K.FIRST..P_K.LAST LOOP
DBMS_OUTPUT.PUT_LINE('THE VALUES OF P_K ARE' || P_K(I));
END LOOP;
END P1;
/