PLS-00341: 游标 'PROJECT_PARAMS_CSR' 的声明不完整或格式错误
PLS-00341: declaration of cursor 'PROJECT_PARAMS_CSR' is incomplete or malformed
这在 oracle 12.2 中完美运行。问题出现在 11g R2 中。
我有下面的光标。
CURSOR project_params_csr
IS
SELECT project_id,
pop.organization_id,
DECODE(mp.primary_cost_method, 1, NULL, 2, g_project_param_cst_group_id) AS costing_group_id,
wp.default_discrete_class AS wip_acct_class_code,
DECODE(pop.transfer_ipv, 'Y', pop.ipv_expenditure_type, NULL) AS ipv_expenditure_type,
DECODE(pop.transfer_erv, 'Y', pop.erv_expenditure_type, NULL) AS erv_expenditure_type,
DECODE(pop.transfer_freight, 'Y', pop.freight_expenditure_type, NULL) AS freight_expenditure_type,
DECODE(pop.transfer_tax, 'Y', pop.tax_expenditure_type, NULL) AS tax_expenditure_type,
DECODE(pop.transfer_misc, 'Y', pop.misc_expenditure_type, NULL) AS misc_expenditure_type
FROM pa_projects_all pp,
pjm_org_parameters pop,
mtl_parameters mp,
wip_parameters wp
WHERE pp.pm_product_code = 'PJM'
AND mp.organization_id = pop.organization_id
AND wp.organization_id = pop.organization_id
AND pop.organization_id IN (SELECT * FROM TABLE(g_project_param_org_ids_tbl))
AND pp.name LIKE p_prefix || '%';
下面这个游标是声明部分的变量。
p_prefix IN VARCHAR2,
g_project_param_org_ids_tbl
是包规范中定义并在正文中初始化的 table。
TYPE number_tbl_type IS TABLE OF NUMBER;
g_project_param_org_ids_tbl number_tbl_type;
g_project_param_org_ids_tbl := number_tbl_type(602, 603);
g_project_param_cst_group_id
也是全局变量,定义在包规范中。
g_project_param_cst_group_id NUMBER := 1020;
可能是什么问题?我该如何修改它?
下面的问题
AND pop.organization_id IN (SELECT * FROM TABLE(g_project_param_org_ids_tbl))
在 Oracle 12c 之前,TABLE() 函数只能应用于架构中定义的集合。 (作为 SQL 类型)
因此,Oracle 11g 在这种情况下不理解 g_project_param_org_ids_tbl
。您可能应该将其创建为 SQL Type first
CREATE OR REPLACE TYPE number_tbl_type IS TABLE OF NUMBER;
/
这在 oracle 12.2 中完美运行。问题出现在 11g R2 中。
我有下面的光标。
CURSOR project_params_csr
IS
SELECT project_id,
pop.organization_id,
DECODE(mp.primary_cost_method, 1, NULL, 2, g_project_param_cst_group_id) AS costing_group_id,
wp.default_discrete_class AS wip_acct_class_code,
DECODE(pop.transfer_ipv, 'Y', pop.ipv_expenditure_type, NULL) AS ipv_expenditure_type,
DECODE(pop.transfer_erv, 'Y', pop.erv_expenditure_type, NULL) AS erv_expenditure_type,
DECODE(pop.transfer_freight, 'Y', pop.freight_expenditure_type, NULL) AS freight_expenditure_type,
DECODE(pop.transfer_tax, 'Y', pop.tax_expenditure_type, NULL) AS tax_expenditure_type,
DECODE(pop.transfer_misc, 'Y', pop.misc_expenditure_type, NULL) AS misc_expenditure_type
FROM pa_projects_all pp,
pjm_org_parameters pop,
mtl_parameters mp,
wip_parameters wp
WHERE pp.pm_product_code = 'PJM'
AND mp.organization_id = pop.organization_id
AND wp.organization_id = pop.organization_id
AND pop.organization_id IN (SELECT * FROM TABLE(g_project_param_org_ids_tbl))
AND pp.name LIKE p_prefix || '%';
下面这个游标是声明部分的变量。
p_prefix IN VARCHAR2,
g_project_param_org_ids_tbl
是包规范中定义并在正文中初始化的 table。
TYPE number_tbl_type IS TABLE OF NUMBER;
g_project_param_org_ids_tbl number_tbl_type;
g_project_param_org_ids_tbl := number_tbl_type(602, 603);
g_project_param_cst_group_id
也是全局变量,定义在包规范中。
g_project_param_cst_group_id NUMBER := 1020;
可能是什么问题?我该如何修改它?
下面的问题
AND pop.organization_id IN (SELECT * FROM TABLE(g_project_param_org_ids_tbl))
在 Oracle 12c 之前,TABLE() 函数只能应用于架构中定义的集合。 (作为 SQL 类型)
因此,Oracle 11g 在这种情况下不理解 g_project_param_org_ids_tbl
。您可能应该将其创建为 SQL Type first
CREATE OR REPLACE TYPE number_tbl_type IS TABLE OF NUMBER;
/