1
CREATE TYPE PROD_RPT_DTL IS object
(
DIVISION_ID NUMBER(6),
DIVISION_NM VARCHAR2(100),
DEPT_ID NUMBER(10),
DEPT_NM VARCHAR2(100),
WORK_FLOOR_ID NUMBER(10),
...........................
)/
CREATE TYPE PROD_RPT_DTL_TABLE is TABLE OF PROD_RPT_DTL
- >過程返回PROD_RPT_DTL_TABLE類型是oracle的動態sql
PROCEDURE sp_GetAllInQtyDetailForCutting(V_PROD_RPT_DTL out PROD_RPT_DTL_TABLE);
- >現在我的程序正在執行像下面的代碼東西
DECLARE
v_PROD_RPT_DTL PROD_RPT_DTL_TABLE:=PROD_RPT_DTL_TABLE();
vv_PROD_RPT_DTL PROD_RPT_DTL_TABLE:=PROD_RPT_DTL_TABLE();
WHEREClause varchar2(500);
QUERY VARCHAR2(2000);
CUR SYS_REFCURSOR;
BEGIN
--calling procedure to return valued in v_PROD_RPT_DTL
sp_GetAllInQtyDetailForCutting(v_PROD_RPT_DTL);
WHEREClause := ' Where division_id=1'; ;
--> now v_PROD_RPT_DTL is a nested table and i have to apply some dynamic filter on it.
QUERY := 'SELECT * bulk collect INTO vv_PROD_RPT_DTL FROM Table(cast(v_PROD_RPT_DTL AS PROD_RPT_DTL_TABLE))' || WHEREClause ;
open cur for QUERY;
.................................................
END ;
當我運行整個事情我得到錯誤
ORA-00904: "V_PROD_RPT_DTL": invalid identifier
ORA-06512: at "SCHEMA.PKG_PROD_REP_MDL", line 52
ORA-06512: at line 4 !
第52行是QUERY:= ......
請問我的PL/SQL有什麼問題請指教。