我在包中声明了一个嵌套的表类型,所以不要理解我在这里收到的错误。
CREATE OR REPLACE PACKAGE model_collection_types
IS
TYPE project_sk_list IS TABLE OF dw_dim_project.project_sk%TYPE;
END model_collection_types;
/
DECLARE
drug_projects model_collection_types.project_sk_list;
CURSOR c1 IS
SELECT a.project_sk
FROM dw_dim_project a
INNER JOIN dw_dim_program b ON a.program_sk = b.program_sk
WHERE a.status_cd = 1
AND b.program_category_desc = 'DRUG'
AND a.state = 'ACTIVE';
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO drug_projects;
CLOSE c1;
dbms_output.put_line(drug_projects.count || ' projects insertred into drug_projects table');
FOR l_row IN drug_projects.first .. drug_projects.last
LOOP
dbms_output.put_line('Project_SK : ' || l_row || ' ' || drug_projects(l_row));
END LOOP;
SELECT column_value
FROM TABLE (drug_projects) c;
END;
/
任何建议表示赞赏,我也尝试了SELECT * FROM COLUMN_VALUE FROM TABLE(drug_projects)
。